ineg 0x74
Negates the int on top of the stack.
- Opcode
0x74(116)- Family
- Arithmetic and bitwise
- Operands
- none
- Length
- 1 byte
- Operand stack
…, value (int) → …, result (int)- Can throw
- nothing at run time (beyond linking errors)
What it does
Negates the int on top of the stack: -x in Java. Negating the minimum value gives the minimum value back, because the result wraps around.
How often javac uses it
In JDK 25.0.5's java.base module, ineg appears 279 times in 77 of its 7,391 classes: 0.01% of all instructions, the 138th most common of 194 opcodes in use. Some of the methods that use it: java.io.Reader$2.skip, java.lang.AbstractStringBuilder.delete, java.lang.Character$UnicodeScript.of, java.lang.FdLibm$IEEEremainder.__ieee754_fmod.
Example
From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; ineg is highlighted.
static int ints(int a, int b) in Tour, compiled by javac 25Related instructions
lneg Negates the long on top of the stack.fneg Negates the float on top of the stack.dneg Negates the double on top of the stack.
Specification: JVMS §6.5, ineg (Java SE 25).