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
| Type | Field | What it holds |
|---|---|---|
u1 | tag | 3 |
u4 | bytes | the 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:
| Offset | Bytes | Field | Value |
|---|---|---|---|
| 347 | 5 bytes | #37 Integer | 1000 |
| 347 | 03 | tag | 3 (Integer) |
| 348 | 00 00 03 e8 | bytes | 1000 |
Specification: JVMS §4.4, CONSTANT_Integer_info (Java SE 25).