bipush 0x10

Pushes a byte, sign-extended to int.

Opcode
0x10 (16)
Family
Constants
Operands
  • 1 byte: signed byte value
Length
2 bytes
Operand stack
… → …, value (int)
Can throw
nothing at run time (beyond linking errors)

What it does

Pushes the signed byte operand as an int. javac uses it for int, short, byte and char constants from -128 to 127 (outside -1 to 5, which have iconst forms).

How often javac uses it

In JDK 25.0.5's java.base module, bipush appears 89,187 times in 1,748 of its 7,391 classes: 4.6% of all instructions, the 4th most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedReader.fill, java.io.ByteArrayOutputStream.<init>, java.io.CharArrayWriter.<init>, java.io.DataInputStream.<init>.

Examples

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

public Nestmates() in Nestmates, compiled by javac 25
2public class Nestmates {
0aload_0 // this
1invokespecial #1// new Object()
3private int secret = 42;
4aload_0 // this
5bipush 42
7putfield #7// Nestmates.secret : int

Open in the viewer

static int sparse(int code) in Tour, compiled by javac 25
103switch (code) {
0iload_0 // code
1lookupswitch { 1→36, 100→39, 10000→42, default→45 }
104case 1: return 10;
36bipush 10
105case 100: return 20;
39bipush 20
106case 10000: return 30;
42bipush 30
107default: return 0;

Open in the viewer

Related instructions

iconst_0 Pushes the int constant 0.sipush Pushes a short, sign-extended to int.ldc Pushes a constant from the constant pool (index in one byte).

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