Integer literals are used to initialize integer group datatypes like
byte , short , int and long . These literals are nothing but a sequence of digits. If they are suffixed with L or l , they are long literals. They are prefixed with zero '0' for octal, '0b' for binary and '0x' for hexa decimal formats. If there is no prefix then it is decimal format. e.g., 53, 189, 211012L, 1199l, 0351, 0x12c2a4d2, 0x12c2a4d2L, 0352l, 0b10011101
We can specify the integers either in decimal, hexadecimal, octal format or binary format. To represent the type as
long integer we use L or l as a suffix.
int decimal = 26; // The number 26, in decimal
int hexadecimal = 0x1a; // The number 26, in hexadecimal
int octal = 032; // The number 26, in octal
byte binary = 0b11010; // The number 26, in binary
long long1 = 7512884L; // The number 7512884, in decimal
long hexadecimal_long = 0xab221eeL; // The number 179446254, in hexa-decimal ![]()
|