We all know that the basic data types related to Oracle Java are unsigned. The basic data types related to java are unsigned and unsigned, therefore, their related values are fixed and will not change as the hardware environment or operating system of the machine changes.
Oracle Java simple data type
Simple type size range/precision
Float 4-byte 32-bit IEEE 754 single precision
Double 8-byte 64-bit IEEE 754 dual precision
Byte 1 byte-128 to 127
Short 2 bytes-32,768 to 32,767
Int 4-2,147,483,648 to 2,147,483,647
Long 8 bytes-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Char 2-byte full Unicode Character Set
Boolean 1-bit True or false
1 byte is fixed by 8-bit binary
For example, if the byte range is-128 to 127, what should you do if you want to change it to 0 to 255? Just perform operations with 0XFF.
For example, if you want to assign a value of 255 to byte bb, that is not acceptable. Even if the value is assigned, the value of bb is also the value of-1 after the 255-to-256 modulo.
If you just want to get the value from 0 to 255, it's very easy,
Bb & 0XFF, for example, bb =-1, the bb & 0XFF result is 255,
The operation result is implicitly converted to the int type because the bytes cannot be placed.
It is faster than addition and subtraction.
The above content is an unsigned introduction to the basic data type of Oracle Java. I hope you will get some benefits.