int i = 2;
System.out.println("i 十进制= [" + i + "] ;" + "i 二进制= [" + Integer.toBinaryString(i) + "]");
i = i << 1;
System.out.println("i 十进制= [" + i + "] ;" + "i 二进制= [" + Integer.toBinaryString(i) + "]");
结果:
i 十进制= [2] ;i 二进制= [10]
i 十进制= [4] ;i 二进制= [100]
Process finished with exit code 0