
package scanner; public class LeftMove { public static void main(String[] args) { int i = 1; System.out.println("i 右移两位:" + (i>>2) ); // System.out.println("i 左移两位:" + (i<<2) ); // for (int j = 0; j < 4; ++j) { int result = 1 << ((j + 2) % 4); // "<<"为左结合性 System.out.println("1 << ((" + j + " + 2) % 4)) = " + result); } }
}