Search today to a more useful online compiler, I hope to share with you.
In addition to Java and C + + ..., the address is http://www.tutorialspoint.com/compile_java_online.php
In addition today again reviewed the Java left and right shift, here for negative numbers for example:
Positive and negative numbers are expressed in the form of complement in Java
For example, 2 is represented in the computer as 11111111 11111111 11111111 11111110
1. Move left
The result of the -2<<2-2 left Shift 2 bit is: 11111111 11111111 11111111 11111000 (Low-fill 0)
Above is the complement, the highest bit is 1 indicates that this is negative, the complement of negative number is the original code of positive number: "The highest bit is 1, the rest of you take the opposite, and finally add 1" to get.
So push back and you'll know that -2<<2 's results actually represent the number of 10000000 00000000 00000000 00001000 (-8)
2. Move Right
The high is 1, 1, and the high is 0.0
-2>>2:11111111 11111111 11111111 11111111
10000000 00000000 00000000 00000001 (-1)
3. The shift operator can be combined with "="
A<<=2 represents the value of a 2-bit left shift to a
4. Add: The Java Virtual machine masks The small end of the problem, the interior is small.
Java left and right shift