什么是>>在java中?
Possible Duplicate:
Double Greater Than Sign (>>) in Java?
What does the following achieve ?
int num = (10-2) >> 1;
Found this very helpful -
What are bitwise shift (bit-shift) operators and how do they work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
右移。它将数字的所有位向右移动指定的数字
10-2 = 8 = 1000(二进制
8 >>>) 1 = 1000 >>> 1 = 100 二进制 = 4
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它在java中按位右移。
它将所有二进制数字向右移动 1 位,并在最左端粘贴一个零。
(10-2)=8,二进制为 1000,
现在右移每个数字并在最左边的位置粘贴 0,得到 0100,等于 4。
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
谷歌上的第一个结果“>>operator java”
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