public static int floorDiv (int x, int y)

Returns the largest (closest to positive infinity)
` int`

value that is less than or equal to the algebraic quotient.
There is one special case, if the dividend is the
Integer.MIN_VALUE and the divisor is ` -1`

,
then integer overflow occurs and
the result is equal to ` Integer.MIN_VALUE`

.

Normal integer division operates under the round to zero rounding mode (truncation). This operation instead acts under the round toward negative infinity (floor) rounding mode. The floor rounding mode gives different results from truncation when the exact result is negative.

- If the signs of the arguments are the same, the results of
`floorDiv`

and the`/`

operator are the same.

For example,`floorDiv(4, 3) == 1`

and`(4 / 3) == 1`

. - If the signs of the arguments are different, the quotient is negative and
`floorDiv`

returns the integer less than or equal to the quotient and the`/`

operator returns the integer closest to zero.

For example,`floorDiv(-4, 3) == -2`

, whereas`(-4 / 3) == -1`

.

`x` | the dividend | |

`y` | the divisor |

` int`

value that is less than or equal to the algebraic quotient.

`ArithmeticException` | if the divisor ` y` is zero |

floorMod(int, int), floor(double)

Diagram: Math