To convert an int of value of 23 into a long literal, we would need to do what is called type casting:
int num_int = 23; long num_long = (long)num_int;
In the second line, we cast the num_int of the int type to a long literal by using the notation (long)num_int. This is referred to as casting. Casting is the process of converting one data type into another. Although we can cast a long to an int, remember that the number might be outside the int range and some numbers will be truncated if they can't fit into the int.
As is with int, long can also be in octal, hexadecimal, and binary, as shown in the following code:
long num = 117L; long hex_num = 0x75L; long oct_num = 0165L; long bin_num = 0b1110101L;