> indicates greater than , such as: if (a>b) ... The result is a Boolean type
>> denotes a signed right shift , such as: int i=15; The result of the I>>2 is 3, and the removed part will be discarded.
The transition to binary may be better understood, with the result that 0000 1111 (15) to the right 2 digits is 0000 0011 (3), 0001 1010 (18) and the result of right shift 3 is 0000 0011 (3).
>>> no sign right shift :
In binary form, all the numbers to the right to move the corresponding towering digits, low move out (discard), high vacancy of 0. For positive numbers, it is the same as with the signed right, which is different for negative numbers.
Other structures and >> are similar.
The test code is as follows:
public class test{public
static void Main (string[] args) {
System.out.println ("1, the following test:");
int a = 1, b = 2;
System.out.println (a > B);
System.out.println ("\n2, the following test >>:");
System.out.println (">> 2 =" + (>> 2));
System.out.println ("\n3, the following test >>>:");
for (int i = 0; i < i++) {for
(int j = 0; J < + j = j + 5) {
System.out.println (j/(int) (Math.pow 2 , i));
System.out.println (J >>> i);}}}
Other bitwise operators in Java:
~ Bitwise NON (not) (unary operation)
& Bitwise WITH (and)
| bitwise OR (OR)
^ Bitwise exclusive OR (XOR)
>> Move Right
>>> move right, left-empty bits are filled with 0
<< Move Left
&= Bitwise AND Assignment
|= bitwise OR ASSIGN Value
^= or assigned by bitwise
>>= Right Shift Assignment
>>>= to the right, the left blank bits are filled with 0
<<= left-shift assignment