Hexadecimal Octal and Binary literalssuggest change
hexadecimal number is a value in base-16. There are 16 digits,
0-9 and the letters
A-F (case does not matter).
octal number is a value in base-8, and uses the digits
binary number is a value in base-2, and uses the digits
All of these numbers result in the same value,
int dec = 110; // no prefix --> decimal literal int bin = 0b1101110; // '0b' prefix --> binary literal int oct = 0156; // '0' prefix --> octal literal int hex = 0x6E; // '0x' prefix --> hexadecimal literal
Note that binary literal syntax was introduced in Java 7.
The octal literal can easily be a trap for semantic errors. If you define a leading
'0' to your decimal literals you will get the wrong value:
int a = 0100; // Instead of 100, a == 64