Convert int to byte
Format
i2b
Forms
i2b = 93 (0x5d)
Stack
…, value.word1, value.word2 → …, result
Description
The value on top of the operand stack must be of type int. It is popped from the operand stack and converted to a byte result by taking the low-order 16 bits of the int value, and discarding the high-order 16 bits. The low-order word is truncated to a byte, then sign-extended to a short result. The result is pushed onto the operand stack.
Notes
The i2b instruction performs a narrowing primitive conversion. It may lose information about the overall magnitude of value. The result may also not have the same sign as value.
If a virtual machine does not support the int data type, the i2b instruction will not be available.