代码如下:
package yinshifuxi;
public class Integer_0 {
public static void main(String[] args) {
Integer[] array = {new Integer(20),new Integer(40),new Integer("100")};
for (int i = 0; i < array.length; i++) {
System.out.println(Integer.toBinaryString(array[i].intValue()) + "\t");
System.out.println(Integer.toHexString(array[i].intValue()) + "\t");
System.out.println(Integer.toOctalString(array[i].intValue()) + "\t");
System.out.println("-----------------------------");
}
}
}
结果如下:
10100
14
24
那么40的二进制不应该是101000吗?为啥是14?其他问题都一样
-----------------------------
101000
28
50
-----------------------------
1100100
64
144
-----------------------------