I am new to java, and came to know that there are two Right Shift operators in java
>>>, but only one left shift operator
<<. Why is it so?
Because logical and arithmetic left-shift operations are identical (from wikipedia).
Notice what happens to sign bit (left-most bit) in both left shifts.
The right shift operators are one with (
>>) and one without (
>>>) sign-extension. The left shift operation does not have a sign extension component.
For instance, the following expressions are both true:
(0x80000000 >> 1) == 0xC0000000 (0x80000000 >>> 1) == 0x40000000