The Java operator is divided into four categories:
Arithmetic operators, relational operators, logical operators, bitwise operators.
Arithmetic operator (9): +-*/% + +--
Relational operators (6): = = = = > >= < <=
Logical operator (6):&& (with short circuit) | | (or short-circuit)! ^ (XOR) & (with) | (OR)
Bitwise operators (7):& (with operations) | (or operation) ~ (inverse code) ^ (XOR) >> (shift right) << (shift left) >>> (unsigned Right shift)
&: There is a false, that is false
|: There is a truth, that is true
^: The difference is true, the same is false
A number or a number two times, the result is still that number. such as 7^4^4=7 (can be used in encryption, 4 is the secret key)
& and && differences:
2>3 & 2<6: Either True or false on the left, the right side participates in the operation
2>3 && 2<6: When the left is false, the right side does not participate in the operation
| and | | Difference:
2>3 | 2<6: Whether true or false on the left, the right side participates in the operation
2>3 | | 2<6: When the left is true, the right side does not participate in the operation
<<: Multiplied by 2 of the number of moving bits, such as 3<<2=3*2 2 (2-bit moving) =12
>>: Divided by 2 by the number of moves of the power, such as 6<<2=6/2 2 (moving 2-bit) The second square =1
>> and >>> differences:
>>: The maximum number of bits is determined by the highest bit value of the original data.
>>>: No matter what the highest bit is, after the right move, use 0 to fill.
The "Java" operator