idivStack
Before | After |
value1 | result |
value2 | ... |
... |
Pops the top two integers from the operand stack and divides the second-from top integer (value2) by the top integer (value1), i.e. computes (value2 div value1). The quotient result is truncated to the nearest integer (with rounding going towards zero, so 1.7 becomes 1) and placed on the stack.
Exceptions
ArithmeticException - attempt to divide by 0 (i.e. value1 is 0)
Bytecode Type
See Also Description u1 idiv opcode = 0x6C (108)
ldiv, fdiv, ddiv
Notes
Because of the two's-complement representation used for negative numbers, dividing Integer.MIN_VALUE by -1 produces Integer.MIN_VALUE, not Integer.MAX_VALUE as you might expect.