public class MathUtil extends Object
Constructor and Description |
---|
MathUtil() |
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. |
public static int clamp(int value, int low, int high)
value
to between low
and high
(both inclusive).public static int floorDiv(int dividend, int divisor)
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
Copyright © 2017. All rights reserved.