Integers are stored in
two's complement format in
Java (as in almost every other programming language). The leftmost bit of an int is the sign bit - if it's set, the number is negative, if it's cleared, the number is positive.
The >> operator shifts all the bits of the operand to the right and fills in the new bits on the left by copying the sign bit of the operand.
The >>> operator shifts all the bits of the operand to the right and sets the new bits on the left to zero.
For example: Suppose you have the number 11000101.
11000101 >> 2 =
11110001 note that the leftmost bits are set to 1
11000101 >>> 2 =
00110001 note that the leftmost bits are set to 0