java中的">>>"在c#中如何实现 java中的">>>"在c#中如何实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 与C#等价的java代码 public static int foo(int x, int y) { int mask = 0x7fffffff; //Integer.MAX_VALUE for (int i = 0; i < y; i++) { x >>= 1; x &= mask; } return x; } //测试,没有考虑移位数<=0的控制 public static void main(String[] args) { System.out.println((1 >>> 3) == foo(1, 3)); System.out.println((1 >>> 5) == foo(1, 5)); System.out.println((1 >>> 7) == foo(1, 7)); System.out.println((10 >>> 9) == foo(10, 9)); System.out.println((-1 >>> 5) == foo(-1, 5)); System.out.println((-9999 >>> 7) == foo(-9999, 7)); System.out.println((-1234 >>> 3) == foo(-1234, 3)); System.out.println((-10000 >>> 5) == foo(-10000, 5)); System.out.println((-10000 >>> 7) == foo(-10000, 7)); } java源代码文件 关于画圆的精度问题 关于框架的一个问题! 关于java单机版 聊天工具,求助!!!!! 各位大侠帮帮忙啊~~~急!! 求助!实现邮件群发功能的困惑!!! 打包后的类不能双击来运行? 请大家给我讲讲Swing中Layout和serPerferedSize, setSize的关系吧 hashset的遍历为何没有按照输入的顺序 一个困惑我的编译警告 如何在Frame上显示一个动态变化的时间? 高手帮助(javamail)
public static int foo(int x, int y) {
int mask = 0x7fffffff; //Integer.MAX_VALUE
for (int i = 0; i < y; i++) {
x >>= 1;
x &= mask;
}
return x;
} //测试,没有考虑移位数<=0的控制
public static void main(String[] args) {
System.out.println((1 >>> 3) == foo(1, 3));
System.out.println((1 >>> 5) == foo(1, 5));
System.out.println((1 >>> 7) == foo(1, 7));
System.out.println((10 >>> 9) == foo(10, 9));
System.out.println((-1 >>> 5) == foo(-1, 5));
System.out.println((-9999 >>> 7) == foo(-9999, 7));
System.out.println((-1234 >>> 3) == foo(-1234, 3));
System.out.println((-10000 >>> 5) == foo(-10000, 5));
System.out.println((-10000 >>> 7) == foo(-10000, 7));
}