byte bt = (byte) 254; System.out.println ("BT =" +BT); /** * This and the operation is to take the high-level data to remove, accurate is high 1, see the official description of the function, * found that when the parameter is negative, in fact, Byte can only save the decimal number between -128~127, 128 for 128, and so on, 0 means that the parameter is added to the 2 32-time Square, also add 3 bytes of bits, and fill 1, the last byte of the case is actually * For example, the storage is-128, plus 1111 1111 is equivalent to 256-128=128, it becomes an integer 128, * If the deposit is-1, the corresponding integer should be 255, and 256-1=255 * This is why only go to the post eight bit */ System.out.println (Integer.tohexstring (BT&0xff));
- Four basic data types in Java
- Int:byte (8bit, -128 ~ 127), short (16bit), int (32bit), Long (64bit)
- FLOAT: Single precision (32bit float), double precision (64bit double)
- Boolean:true, False
- Char:unicode characters 16 bit
- Corresponding class type
- Integer, Float, Double, Boolean, Character, Byte, short, Long
- Size End
- Small-End Method (Little-endian): Low byte emissions at the lower address end of memory that is the starting address of the value, high-bit bytes emitted in the memory of the higher address
- Big-endian (Big-endian): high-bit byte emissions at the low address end of memory that is the starting position of the value, low-byte emissions at the high address of the memory
The binary in Java