Java的>>与>>>操作? [英] Java's >> versus >>> Operator?
本文介绍了Java的>>与>>>操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我没有我的Java参考书,我有一个艰难的时间找到与谷歌的答案。
什么是Java中的>>和>>>运营商之间的区别?
int值= 0100;INT结果=(价值>> 8);
的System.out.println((值GT;→8)=+结果); //打印:(值GT;→8)= 1结果=(价值>>> 8);
的System.out.println((值GT;>→8)=+结果); //打印:(值GT;>→8)= 1
解决方案
>>>
是的逻辑移位,>>
是的算术移位。
I'm without my Java reference book and I'm having a tough time finding an answer with Google.
What is the difference between the ">>" and ">>>" operators in Java?
int value = 0x0100;
int result = (value >> 8);
System.out.println("(value >> 8) = " + result); // Prints: "(value >> 8) = 1"
result = (value >>> 8);
System.out.println("(value >>> 8) = " + result); // Prints: "(value >>> 8) = 1"
解决方案
>>>
is logical shift, >>
is arithmetic shift.
这篇关于Java的>>与>>>操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文