arraylength

get length of array

Bytecode

Type Description
u1 arraylength opcode = 0xBE(190)

Stack ..., arrayref ==> ..., length

Description

Removes arrayref (a reference to an array) from the stack and replaces it with the length of the array (an int). For multi-dimensional arrays, the length of the first dimension is returned.

The arrayref must be of type reference and must refer to an array. It is popped from the operand stack.

The length of the array it references is determined. That length is pushed onto the operand stack as an int.

Exceptions

NullPointerException - arrayref is null.