iaload 0x2e

Pops an array and an index; pushes the int element.

Opcode
0x2e (46)
Family
Arrays
Operands
none
Length
1 byte
Operand stack
…, arrayref, index → …, value (int)
Can throw
NullPointerException, ArrayIndexOutOfBoundsException

What it does

Pops an array (int[]) and an index; pushes the element at that index.

How often javac uses it

In JDK 25.0.5's java.base module, iaload appears 2,558 times in 291 of its 7,391 classes: 0.13% of all instructions, the 79th most common of 194 opcodes in use. Some of the methods that use it: java.io.ObjectInputStream$FieldValues.get, java.io.ObjectInputStream$HandleTable$HandleList.get, java.io.ObjectOutputStream$BlockDataOutputStream.writeInts, java.io.ObjectOutputStream$HandleTable.lookup.

Examples

From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; iaload is highlighted.

static void array(int[] a, int i) in Increments, compiled by javac 25
22a[i]++;
0aload_0 // a
1iload_1 // i
23}

Open in the viewer

static boolean weekend(DayOfWeek day) in EnumSwitch, compiled by javac 25
20switch (day) {
0getstatic #13// EnumSwitch$1.$SwitchMap$java$time$DayOfWeek : int[]
3aload_0 // day
4invokevirtual #19// DayOfWeek.ordinal() : int
8lookupswitch { 1→36, 2→36, default→38 }
23return true;
25return false;

Open in the viewer

Related instructions

iastore Pops an array, an index and a int value; stores the value in the array.arraylength Pops an array; pushes its length.newarray Pops a length; pushes a new array of a primitive type.

Specification: JVMS §6.5, iaload (Java SE 25).