Java Reference
In-Depth Information
0377_7777_7777 , and
0b1111_1111_1111_1111_1111_1111_1111_1111
It is a compile-time error if a hexadecimal, octal, or binary int literal does not fit in 32 bits.
The largest decimal literal of type long is 9223372036854775808L (2 63 ).
All decimal literals from 0L to 9223372036854775807L may appear anywhere a long literal may
appear.
It is a compile-time error if a decimal literal of type long is larger than 9223372036854775808L
(2 63 ), or if the decimal literal 9223372036854775808L appears anywhere other than as the op-
erand of the unary minus operator (§ 15.15.4 ) .
The largest positive hexadecimal, octal, and binary literals of type long - each of which rep-
resents the decimal value 9223372036854775807L (2 63 -1) - are respectively:
0x7fff_ffff_ffff_ffffL ,
07_7777_7777_7777_7777_7777L , and
0b0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L
The most negative hexadecimal, octal, and binary literals of type long - each of which rep-
resents the decimal value -9223372036854775808L (-2 63 ) - are respectively:
0x8000_0000_0000_0000L , and
010_0000_0000_0000_0000_0000L , and
0b1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000L
The following hexadecimal, octal, and binary literals represent the decimal value -1L :
0xffff_ffff_ffff_ffffL ,
017_7777_7777_7777_7777_7777L , and
0b1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L
It is a compile-time error if a hexadecimal, octal, or binary long literal does not fit in 64 bits.
Examples of int literals:
0
2 0372 0xDada_Cafe 1996 0x00_FF__00_FF
Examples of long literals:
Search WWH ::




Custom Search