One. Bitwise operators
The bit here is the symbol of the bits, bit bit operation.
Viewing the PPT shows that there is more than one bitwise operator, which consists of several operators, even using the operation symbols previously defined.
Two. Analysis of different bit operators
A. & In addition to participation and computation, but also participate in bit operations, specific bit operation process: 6&3, it is important to remember that bit operation is to calculate the bits, 6 of the effective bits is 110, and 3 of the effective BITS is 011. & is used in the operation of the position, still has the function and operation. The logical operation of the binary number of the same position, 0 means that the false,1 represents true. 110&010=010, the conversion to 10 binary number is 2. Eventually, 6&3=2. Note : (1) 6 is actually an int type with a 32-bit binary number, but when the bitwise operation is performed, it is a valid bit, and the extra 0 bits are not involved in the operation. (2) & bit operation also has a feature, arbitrary enumeration of a two binary numbers between the & bit operation,
0111-0101-1010-0110
&0000-0000-0000-1111
As you can see, the result of this bitwise operation is to intercept the latter four bits of data. In special cases, the interception of data is also a feature of the & bit operation.
B. Similarly, the use of the bitwise operator is similar to the & bitwise operator. The bitwise operation is characterized by the ability to retain the valid bits of two binary digits, and 1 is a valid bit,
And the front said the effective bit is not a meaning.
C. ^ bit operation, ^ bit operation is characterized by preserving all, having a 1 position of data. A number XOR or bitwise operation is the same number two times. 6^3=5, 6^3^3=6.
The value has changed completely. If you convert to binary, the binary number is completely changed, which is equivalent to encryption.
In order to ensure the security of data, after encryption to restore data, the restored program is set in the USB drive, which is common in daily life.
Above these three, by borrowing logical operators to act as bitwise operators, a series of decimal results are obtained. But these results are not important,
It is important that computers use these mechanisms to do some other uses.
D. ~ Anti-code bit operation. The anti-code is-7. How to calculate the need to learn .
Java-preliminary Understanding-Chapter III-Bitwise Operators