my code is
final int CONST_1 = 1010;
final int CONST_2 = 1011;
System.out.println("CONST_1 & CONST_2: " + Integer.toBinaryString(CONST_1 & CONST_2));
System.out.println("CONST_1 ^ CONST_2: " + Integer.toBinaryString(CONST_1 ^ CONST_2));
System.out.println("CONST_1 | CONST_2: " + Integer.toBinaryString(CONST_1 | CONST_2));
System.out.println("~CONST_1 : " + Integer.toBinaryString(~CONST_1));
Output is
CONST_1 & CONST_2: 1111110010
CONST_1 ^ CONST_2: 1
CONST_1 | CONST_2: 1111110011
~CONST_1 : 11111111111111111111110000001101
In my opinion it's wrong and it should be:
CONST_1 & CONST_2: 1010
CONST_1 ^ CONST_2: 1
CONST_1 | CONST_2: 1011
~CONST_1 : 101
Please explain me why I have such result. Thanks!