JVM Knowledge

i2b

Raw .md Oracle

Operation

Convert int to byte

Format

i2b

Forms

i2b = 145 (0x91)

Operand Stack

..., value →

..., result

Description

The value on the top of the operand stack must be of type int. It is popped from the operand stack, truncated to a byte, then sign-extended to an int result. That result is pushed onto the operand stack.

Notes

The i2b instruction performs a narrowing primitive conversion (JLS §5.1.3). It may lose information about the overall magnitude of value. The result may also not have the same sign as value.