并发类容器-第一讲
作者:互联网
一、基础知识夯实
1.首先是我们需要懂得几点是在java中的集中运算
直接看代码吧
public class IntToBinary { public static void main(String[] args) throws UnsupportedEncodingException { int data = 4; System.out.println("the 4 is "+Integer.toBinaryString(data)); //位与 &(1&1=1 1&0=0 0&0=0) System.out.println("the 4 is "+Integer.toBinaryString(4)); System.out.println("the 6 is "+Integer.toBinaryString(6)); System.out.println("the 4&6 is "+Integer.toBinaryString(4&6)); //位或 | (1|1=1 1|0=1 0|0=0) System.out.println("the 4|6 is "+Integer.toBinaryString(4|6)); //位非~(~1=0 ~0=1) System.out.println("the ~4 is "+Integer.toBinaryString(~4)); //位异或 ^ (1^1=0 1^0=1 0^0=0)(有相同的就是 1 ) System.out.println("the 4^6 is "+Integer.toBinaryString(4^6)); // <<有符号左移 >>有符号的右移 >>>无符号右移 System.out.println("the 1 << 4 is "+Integer.toBinaryString(4 << 1)); System.out.println("the 1 >>> 4 is "+Integer.toBinaryString(4 >>> 1)); //取模的操作 a % (2^n) 等价于 a&(2^n-1) System.out.println("the 345 % 16 is "+(345%16)+ " or "+(345&(16-1))); } }View Code
标签:容器,第一,16,System,并发,toBinaryString,println,Integer,out 来源: https://www.cnblogs.com/lys-lyy/p/11072796.html