java Bit operations >>> shift
Why if int x = -1 // binary: 11111111111111111111111111111111 x = x >>> 31; we have 00000000000000000000000000000001 but if int x = -1 x = x >>> 32; we have 11111111111111111111111111111111 (again -1) but not 00000000000000000000000000000000 ? From Section 15.19 of JLS : If the promoted type of the left-hand operand is int, only the five lowest-order bits of the right-hand operand are used as the shift distance . It is as if the right-hand operand were subjected to a bitwise logical AND operator & (§15.22.1) with the mask value 0x1f (0b11111) . The shift distance actually used is therefore