Java 位运算(移位、位与、或、异或、非)
Java提供的位运算符有:左移( << )、右移( >> ) 、无符号右移( >>> ) 、位与( & ) 、位或( | )、位非( ~ )、位异或( ^ ),除了位非( ~ )是一元操作符外,其它的都是二元操作符。
1、左移( << )
Test1、将5左移2位:
package com.xcy;public class Test {public static void main(String[] args) {int a = 5a &= 3;System.out.println(a);//结果是1}}- 1楼llhhyy19891小时前
- 我在程序中用过~[e04]
- Re: xiaochunyong36分钟前
- ^_^,头像很有爱啊,哈哈回复llhhyy1989