Possible Duplicate:
Double Greater Than Sign (>>) in Java?
What does the following achieve ?
int num = (10-2) >> 1;
Found this very h开发者_如何学Goelpful -
What are bitwise shift (bit-shift) operators and how do they work?
Shift right. It moves all the bits of the number right by the number specified
10-2 = 8 = 1000 in binary
8 >> 1 = 1000 >> 1 = 100 in binary = 4
>>
is just an operator to perform bitwise right shift
its bitwise right shift in java. it shifts all binary digits,1 place towards right and pastes a zero at the leftmost end. (10-2)=8 which is 1000 in binary, now right shifting each digit and pasting 0 at the leftmost position, it gives 0100 which equals 4.
Right shift the indicated number of bits.
http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
First result on google for ">> operator java"
See the documentation here on Bitwise shift right
精彩评论