Bit operation:
If negative numbers are involved:
Calculation process: 1. Find the binary number corresponding to the absolute value of the negative number
2. to reverse
3. Go +1
4. Complement code
5. Calculate the binary number
6. Convert to decimal number
Note: byte: represents a byte, the length of a byte is 8 bits, and the size range of the byte type number is -2^(8-1)~2^(8-1)-1, namely: -128~ 127
Complement code, for example, when a byte number is converted to an int number, the int number is 4 bytes, the length is 32 bits, and the byte is only 8 bits. The complement code needs to be supplemented with 24 1s in front of the byte number.
0xff: The numbers starting with 0x represent hexadecimal numbers, and those starting with 0 represent octal numbers. 0xff: It means hexadecimal number, an f means binary represented by 16,16
is 1111.
Calculation process picture: