Negative logical shift
- by user320862
In Java, why does -32 -1 = 1 ?
It's not specific to just -32. It works for all negative numbers as long as they're not too big.
I've found that
x -1 = 1
x -2 = 3
x -3 = 7
x -4 = 15
given 0 x some large negative number
Isn't -1 the same as << 1? But -32 << 1 = -64.
I've read up on two's complements, but still don't understand the reasoning.