List of utility methods to do Integer Clamp
int | clamp(int i, int low, int high) Converts input number to a number within the specified range. return Math.max(Math.min(i, high), low);
|
int | clamp(int i, int min, int max) clamp if (min >= max) throw new IllegalArgumentException("Min must be less than max. " + min + " >= " + max); if (i < min) return min; if (i > max) return max; return i; |
int | clamp(int min, int val, int max) clamp return Math.min(Math.max(val, min), max); |
int | clamp(int min, int value, int max) clamp return Math.min(max, Math.max(min, value));
|
int | clamp(int n, int l, int u) clamp return Math.max(Math.min(n, u), l);
|
int | clamp(int n, int lower, int upper) Limit the value n between lower and upper return Math.max(lower, Math.min(n, upper));
|
int | clamp(int n, int min, int max) clamp if (n > max) return max; if (n < min) return min; return n; |
int | clamp(int n, int min, int max) Restrains a number in a interval if (min > max) return clamp(n, max, min); if (n < min) n = min; if (n > max) n = max; return n; |
int | clamp(int num, int min, int max) Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and third parameters. return num < min ? min : (num > max ? max : num);
|
int | clamp(int number, int low, int high) Returns a number clamped between low and high inclusive. if (low == high) return low; int _low = Math.min(low, high); int _high = Math.max(low, high); return Math.min(Math.max(number, _low), _high); |