public static int floorMod (int x, int y)

Returns the floor modulus of the int arguments.

The floor modulus is x - (floorDiv(x, y) * y), has the same sign as the divisor y, and is in the range of -abs(y) < r < +abs(y).

The relationship between floorDiv and floorMod is such that:

The difference in values between floorMod and the % operator is due to the difference between floorDiv that returns the integer less than or equal to the quotient and the / operator that returns the integer closest to zero.

Examples:

If the signs of arguments are unknown and a positive modulus is needed it can be computed as (floorMod(x, y) + abs(y)) % abs(y).

Parameters:
x    the dividend
y    the divisor

Returns:  the floor modulus x - (floorDiv(x, y) * y)

Exceptions:
ArithmeticException    if the divisor y is zero

See also:
floorDiv(int, int)

Since:  1.8