List of utility methods to do Integer Clamp
String | clampString(String string, int limit) clamp String return string.substring(0, string.length() > limit ? limit : string.length());
|
int | clampTo_0_255(int i) clamp T_ return i > 255 ? 255 : (i < 0 ? 0 : i);
|
int | clampToByte(int c) Clamp a value to the range 0..255 if (c < 0) return 0; if (c > 255) return 255; return c; |
int | clampToByteSize(int value) Clamp a value, I.E. if (value >= BYTE_MAX_SIZE) { return BYTE_MAX_SIZE; } else if (value <= 0) { return 0; return value; |
short | clampToShort(int x) clamp To Short return (short) (x > Short.MAX_VALUE ? Short.MAX_VALUE : (x < Short.MIN_VALUE ? Short.MIN_VALUE : x)); |
short | clampUShortNegative(int in) clamp U Short Negative return (in < 0 ? (short) 0 : (short) in); |
int | ClampValue(int value, int lowerBound, int upperBound) Clamp Value if (value < lowerBound) { return lowerBound; } else if (value > upperBound) { return upperBound; } else { return value; |