java异或运算符求详细过程
发布网友
发布时间:2022-04-21 04:45
我来回答
共1个回答
热心网友
时间:2022-06-18 01:26
int 32位,补码存储
int a = 51;
int b = -16;
System.out.println("51 =" + Integer.toBinaryString(a));
System.out.println("-16 =" + Integer.toBinaryString(b));
int c = a^b;
System.out.println("异或 =" + Integer.toBinaryString(c));
System.out.println("即 =" + c);
51 =110011
-16 =11111111111111111111111111110000
异或 =11111111111111111111111111000011
原码为1000。。。111101
即 =-61