iaload : retrieve integer from array : index : visitInsn()

Description
Retrieves an entry from a int array and places it on the stack. arrayref is a reference to an array of ints. index is an int. The arrayref and index are removed from the stack, and the int value at the given index in the array is pushed onto the stack.
Example
; get x[1], where x is an int array stored in local variable 1
aload_1          ; push an integer array onto the stack
iconst_1         ; push the integer 1 onto the stack
iaload           ; get the int at index 1 from the array
                 ; the top item on the stack is now x[1]
Exceptions

NullPointerException - arrayref is null

ArrayIndexOutOfBoundsException - index is < 0 or >= arrayref.length
Notes
Array indices start at 0 (the first entry in the array is at index 0).
See also
laload faload daload aaload baload caload saload iastore lastore fastore dastore aastore bastore castore sastore
Stack
Before After
index value
arrayref ...
... ...
Bytecode
Type Description
u1 iaload opcode = 0x2E (46)