位运算

package operator;

public class Demo06 {
//位运算
public static void main(String[] args) {
/*
A = 0011 1100
B = 0000 1101

A&B 0000 1100
A|B 0011 1101
A^B 0011 0001(相同则0 不同为一)
~B 1111 0010

//位运算 效率极高
2*8 = 16 2*2*2*2
<<(左移),>>(右移)

0000 0001 1
0000 0010 2
0000 0100 4
0000 1000 8
0001 0000 16
*/
System.out.println(2<<3);//=2^3
}
}
posted @ 2021-04-21 14:42  杨得体  阅读(50)  评论(0)    收藏  举报