Pretending ints are 8-bit binary: 1 is 00000001 ~1 is 11111110 2 is 00000010 So if you add ~1 to 2 and ignore the overflow bit, you get 00000000. Since ~1 plus 2 is 0, ~1 must is a good way to represent -2, and is indeed how Java represents -2, except that ints are really 32 bits, not 8 bits.