Mega Code Archive

 
Categories / Java Book / 001 Language Basics
 

0012 hexadecimal (base 16)

hexadecimal matches with modulo 8 word sizes, such as 8, 16, 32, and 64 bits. You signify a hexadecimal constant with a leading zero-x, (0x or 0X). The range of a hexadecimal digit is 0 to 15, so A through F (or a through f ) are substituted for 10 through 15. An integer literal can always be assigned to a long variable. An integer can also be assigned to a char as long as it is within range. public class Main{ public static void main(String[] argv){ int f = 0XFFFFF; System.out.println(f);//1048575 } }