If I print out ~100
in Java, I get -101
. I'm trying to work this out by hand.
The NOT (~
) operator inverts all bits.
100
in binary is 00000000000000000000000001100100
.
inverting its bits gives:
11111111111111111111111110011011
Now what? How do I get -101
?