为什么以及如何 System.out.println(~4); 给出输出-5 和 System.out.println(~0); 给出输出 -1 ?
最佳答案
4 is 00000000 00000000 00000000 00000100
~4 is 11111111 11111111 11111111 11111011 = -5
0 is 00000000 00000000 00000000 00000000
~0 is 11111111 11111111 11111111 11111111 = -1
关于java - Java 中的二进制补码运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29139792/