如何进制转换
程序员文章站
2024-01-06 17:27:52
...
int a = 32;
System.out.println("二进制: "+Integer.toBinaryString(a));
System.out.println("十六进制: "+Integer.toHexString(a));
System.out.println("八进制: "+Integer.toOctalString(a));
System.out.println("十二进制: "+Integer.toString(month, 12));
String s="66";
System.out.println(Integer.toString(Integer.parseInt(s,12), 6));