@@ -49,23 +49,23 @@ public List<Integer> grayCode(int n) {
49
49
}
50
50
}
51
51
52
- public static void main (String ... args ) {
52
+ public static void main (String ... args ) {
53
53
System .out .println ("-----------------------------------------------------------------------------------------" );
54
54
System .out .println ("How to understand i << n? It means n to the power of two, see below. So we have an equivalent solution, which is solution2." );
55
- System .out .println ("1 << 2: " + (1 << 2 ));
56
- System .out .println ("1 << 3: " + (1 << 3 ));
57
- System .out .println ("1 << 4: " + (1 << 4 ));
58
- System .out .println ("1 << 5: " + (1 << 5 ));
59
- System .out .println ("1 << 6: " + (1 << 6 ));
55
+ System .out .println ("1 << 2: " + (1 << 2 ));
56
+ System .out .println ("1 << 3: " + (1 << 3 ));
57
+ System .out .println ("1 << 4: " + (1 << 4 ));
58
+ System .out .println ("1 << 5: " + (1 << 5 ));
59
+ System .out .println ("1 << 6: " + (1 << 6 ));
60
60
System .out .println ("-----------------------------------------------------------------------------------------" );
61
61
System .out .println ("How to understand i >> 1? It means to shift the number i to the right by 1 bit, see below" );
62
- System .out .println ("0 >> 1: " + (0 >> 1 ));
63
- System .out .println ("1 >> 1: " + (1 >> 1 ));
64
- System .out .println ("2 >> 1: " + (2 >> 1 ));
65
- System .out .println ("3 >> 1: " + (3 >> 1 ));
66
- System .out .println ("4 >> 1: " + (4 >> 1 ));
67
- System .out .println ("5 >> 1: " + (5 >> 1 ));
68
- System .out .println ("6 >> 1: " + (6 >> 1 ));
62
+ System .out .println ("0 >> 1: " + (0 >> 1 ));
63
+ System .out .println ("1 >> 1: " + (1 >> 1 ));
64
+ System .out .println ("2 >> 1: " + (2 >> 1 ));
65
+ System .out .println ("3 >> 1: " + (3 >> 1 ));
66
+ System .out .println ("4 >> 1: " + (4 >> 1 ));
67
+ System .out .println ("5 >> 1: " + (5 >> 1 ));
68
+ System .out .println ("6 >> 1: " + (6 >> 1 ));
69
69
}
70
70
71
71
}
0 commit comments