1 package scanner;
 2 
 3 public class LeftMove {
 4     
 5     public static void main(String[] args) {
 6         
 7         int i = 1;
 8         
 9         System.out.println("i 右移两位:" + (i>>2) ); //0
10         
11         System.out.println("i 左移两位:" + (i<<2) ); //4
12         
13         for (int j = 0; j < 4; ++j) {
14             
15             
16             int  result  = 1 << ((j + 2) % 4);
17             
18             //  "<<"为左结合性
19             
20             System.out.println("1 << ((" + j + " + 2) % 4)) = " + result);
21             
22         }
23                 
24     }
25 }

 

相关文章:

  • 2022-02-09
  • 2022-02-02
  • 2021-11-20
  • 2021-06-23
  • 2021-11-29
  • 2021-07-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2022-02-09
相关资源
相似解决方案