i2c : convert integer to character : index : visitInsn()

Description
Converts an integer to a 16-bit unsigned char. A 32-bit int is popped off the stack, the top 16 bits are set to zero and the resulting int value is pushed back onto the stack.

i2c is used in Java when there is an explicit cast between an int and a char. Notice that i2c produces an unsigned value - any sign bit for the original number is lost. For example, in the code:

    int x = -1;
    char c = (char)x;
The value of c is positive 0xFFFF.
See also
i2b i2s
Stack
Before After
value result
... ...
Bytecode
Type Description
u1 i2c opcode = 0x92 (146)