CONSTANT_Integer tag 3

An int constant.

Tag
3
Since
class file 45.0 (Java 1.0)
Size
5 bytes
Loadable
yes, with ldc, ldc_w
Referred to by
  • ldc and ldc_w
  • ConstantValue attributes of int, short, char, byte and boolean fields
  • bootstrap method arguments

Layout

TypeFieldWhat it holds
u1tag3
u4bytesthe int, big-endian

What it is for

An int constant. javac puts an int in the constant pool only when it does not fit an instruction: -1 to 5 have iconst, -128 to 127 bipush, -32768 to 32767 sipush. Anything larger is ldc of an Integer.

The same tag holds the ConstantValue of boolean, byte, char and short static final fields, since those are ints in the JVM.

How common it is

JDK 25.0.5's java.base has 10,819 Integer constants in 916 of its 7,391 classes: 1.0% of all 1,059,609 constants.

A real one, byte by byte

Constant #37 of Constants.class, compiled by javac 25:

OffsetBytesFieldValue
3475 bytes#37 Integer1000
34703tag3 (Integer)
34800 00 03 e8bytes1000

Open in the viewer

Specification: JVMS §4.4, CONSTANT_Integer_info (Java SE 25).