Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Convert int to byte2 in java
Convert int to byte2 in java
Because in java, the type of int accounts for 4 bytes and byte accounts for 1 byte, when the type of int is converted into the type of byte, there will be bit loss, that is, the lower 8 bits of int are taken as the value of the type of byte. The value of the int variable is 257, the corresponding binary is 1000000 1, the last 8 bits are 000000 1, and the first 0 represents the sign bit, indicating a positive number, so the value of the variable x is 1.