Why is (-1 >>> 32) = -1? [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: why is 1>>32 == 1? -1 as an int converted to binary is represented by 32 1's. When I right-shift it 31 times, I get 1 (31 0's and one 1). But when I right-shift it 32 times, I get -1 again. Shouldn't it be equal to 0? 回答1: The Java specification explains the shift operators as follows: 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