简单类型 / 数字 / Integer

//decimal number system
int decimal = 42;

//octal number system
int octal = 042;
//octal is 34

//hexadecimal number system
int hexadecimal = 0x42;
//hexadecimal is 66

//binary number system
int binary = 0b1010;
//binary is 10

//42 to decimal string
var sDecimal = Integer.toString(42);
//sDecimal is "42"

//42 to octal string
var sOctal = Integer.toString(428);
//sOctal is "52"

//42 to hexadecimal string
var sHexadecimal = Integer.toString(4216);
//sHexadecimal is "2a"

//42 to binary string
var sBinary = Integer.toString(422);
//sBinary is "101010"

System.out.println("decimal = " + decimal);
System.out.println("octal = " + octal);
System.out.println("hexadecimal = " + hexadecimal);
System.out.println("binary = " + binary);
System.out.println("sDecimal = " + sDecimal);
System.out.println("sOctal = " + sOctal);
System.out.println("sHexadecimal = " + sHexadecimal);
System.out.println("sBinary = " + sBinary);