KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ShiftOps


1 public class ShiftOps {
2     
3     public static void main(String JavaDoc [] args){
4         long l = 2;
5         l = l >> 1;
6         System.out.println("l: "+l);
7         l = 2;
8         l = l << 1;
9         System.out.println("l: "+l);
10         l = 2;
11         l = l >>> 1;
12         System.out.println("l: "+l);
13         
14         l = 2L;
15         l = l >> 1;
16         System.out.println("l: "+l);
17         l = 2L;
18         l = l << 1;
19         System.out.println("l: "+l);
20         l = 2L;
21         l = l >>> 1;
22         System.out.println("l: "+l);
23         
24         
25     }
26 }
27
Popular Tags