什么<<在java中意思? [英] What does << mean in java?
本文介绍了什么<<在java中意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找不到什么<<在java中意味着,因为我无法在Google上搜索它,我绝对迷失了!
I can't find out what << means in java, because I can't search for it on Google I am absolutely lost!
有问题的代码是:
public int getRGB() {
return ((red << 16) | (green << 8) | blue);
}
取自 http://java.sun.com/docs/books/tutorial/essential/concurrency/example/ImmutableRGB.java
非常感谢有人告诉我,谢谢!
Would really appreciate someone telling me, thanks!
推荐答案
位的左移
如果红色== 4(二进制为:00000100),则红色<< 16将在其右侧插入16个0位,产生:000001000000000000000000,其为小数262144
If red == 4 (which in binary is: 00000100) then red << 16 will insert sixteen 0-bits at its right, yielding: 000001000000000000000000 which is 262144 in decimal
这篇关于什么<<在java中意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文