---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 27 Edition"
java_version: 27
chapter: "Chapter 6. The Java Virtual Machine Instruction Set"
section: "6.5.arraylength"
heading: "arraylength"
parent: "6.5. Instructions"
source: https://docs.oracle.com/javase/specs/jvms/se27/html/jvms-6.html#jvms-6.5.arraylength
id: "6.5.arraylength"
url: https://jvm.obfuscated.software/jvms/se27/6.5.arraylength.html
raw: https://jvm.obfuscated.software/jvms/se27/6.5.arraylength.md
---

# arraylength

## Operation

Get length of array

## Format

```
arraylength
```

## Forms

*arraylength* = 190 (0xbe)

## Operand Stack

..., *arrayref* →

..., *length*

## Description

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`.

## Run-time Exceptions

If the *arrayref* is `null`, the *arraylength* instruction throws a `NullPointerException`.
