pythagoras.i

## Class MathUtil

• ```public class MathUtil
extends Object```
Math utility methods.
• ### Constructor Summary

Constructors
Constructor and Description
`MathUtil()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static int` ```clamp(int value, int low, int high)```
Clamps the supplied `value` to between `low` and `high` (both inclusive).
`static int` ```floorDiv(int dividend, int divisor)```
Computes the floored division `dividend/divisor` which is useful when dividing potentially negative numbers into bins.
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### MathUtil

`public MathUtil()`
• ### Method Detail

• #### clamp

```public static int clamp(int value,
int low,
int high)```
Clamps the supplied `value` to between `low` and `high` (both inclusive).
• #### floorDiv

```public static int floorDiv(int dividend,
int divisor)```
Computes the floored division `dividend/divisor` which is useful when dividing potentially negative numbers into bins.

For example, the following numbers `floorDiv` 10 are:

``` -15 -10 -8 -2 0 2 8 10 15
-2  -1 -1 -1 0 0 0  1  1
```