In Java, numbers can be written by various radix.
// radix 10
int value = 255;
// radix 16
value = 0xff; // starts from 0x
value = 0xFF; // ff can be written as upper case, but not common
value = 0Xff; // x can be upper case, but not common
// radix 8
value = 0377; // starts from 0
// radix 2
value = 0b11111111; // starts from 0b
value = 0b1111_1111; // under score can be put for separation
These are all same values essentially and given for convenience for programmers when reading.
Top comments (0)