if_icmpeq : jump if two integers are equal : index : visitJumpInsn()

Description
if_icmpeq pops the top two ints off the stack and compares them. If the two integers are equal, execution branches to the address (pc + branchoffset), where pc is the address of the if_icmpeq opcode in the bytecode and branchoffset is a 16-bit signed integer parameter following the if_icmpeq opcode in the bytecode. If the integers are not equal, execution continues at the next instruction.

If you are using Jasmin, branchoffset is computed for you from the address of <label>.
Example
    bipush 2        ; push the int 2 onto the stack
    iload_1         ; push the int value in local variable 1 onto the stack
    if_icmpeq Label ; if the value of local variable 1 equals 2, jump to Label
    return          ; return if not equal
Label:
    ; execution continues here if local variable 1 equals 2...
Notes
Addresses are measured in bytes from the start of the bytecode (i.e. address 0 is the first byte in the bytecode of the currently executing method).
See also
if_icmpne if_icmplt if_icmpgt if_icmple if_icmpge
Stack
Before After
value1 ...
value2 ...
... ...
Bytecode
Type Description
u1 if_icmpeq opcode = 0x9F (159)
s2 branchoffset