System.out.println("******************************");
int a = 9;
System.out.println("a "+a);
System.out.println("a>>1 "+ (a>>1));
int b = (a>>1);
System.out.println("b "+b);
System.out.println("a>>1 "+ (a>>1));
System.out.println("******************************");
int x = -9;
System.out.println("x "+ (x)+ " ");
System.out.println(Integer.toBinaryString(x));
System.out.println("x>>>1 "+(x>>>1)+ " ");
System.out.println(Integer.toBinaryString(x>>>1));
System.out.println("******************************");
x = -9;
System.out.println("x "+(x)+ " ");
System.out.println(Integer.toBinaryString(x));
System.out.println("x>>1 "+(x>>1)+ " ");
System.out.println(Integer.toBinaryString(x>>1));
测试左移和右移代码
最新推荐文章于 2024-07-16 16:41:25 发布