iinc <varnum> <n> or wide iinc <varnum> <n>In the first form, <varnum> is an unsigned integer in the range 0 to 0xFF and <n> is a signed integer in the range -128 to 127. In the second (wide) form, <varnum> is an unsigned integer in the range 0 to 0xFFFF and <n> is a signed integer in the range -32768 to <= 32767.
Stack Before
Description After ... ...
iinc increments the int held in the local variable <varnum> by <n>. The iinc instruction takes two parameters: <varnum> is an unsigned integer which indicates which local variable should be used. <n> is the integer amount to increment or decrement the variable by. <varnum> must be a valid local variable number in the current method's frame.
Example
iinc 1 10 ; increment local variable 1 by 10. iinc 1 -1 ; decrement local variable 1 by 1.Bytecode
For local variable numbers in the range 0-255, and values of <n> in the range -128 to 127, use:
Type | Description |
u1 | iinc opcode = 0x84 (132) |
u1 | <varnum> |
s1 | <n> |
Type | Description |
u1 | wide opcode = 0xC4 (196) |
u1 | iinc opcode = 0x84 (132) |
u2 | <varnum> |
s2 | <n> |
wide