List of utility methods to do Number Min Value
int | minInteger(Integer a, Integer b) min Integer if (a == null || b == null) { return Integer.MIN_VALUE; return Math.min(a, b); |
Boolean | minLength(String field, Integer from) min Length return field.length() >= from;
|
boolean | minLength(String value, int min) Checks if the value's length is greater than or equal to the min. return (value.length() >= min);
|
String | minLengthExpression(final String operand, final long minLength) Build expression to check the 'minLength' restriction, depending on the data type of the member variable. return String.format("%s.length() < %d", operand, minLength); |
double | minLimit(double d, double limit) min Limit return d < limit ? limit : d;
|
float | minLimit(float value, float min) min Limit return value < min ? min : value;
|
int | minLog2(int input) min Log int bitMask = 1; int bitPosition = 0; int maxBitMask = 0; while (bitPosition < 31) { if ((bitMask & input) > 0) { maxBitMask = (bitMask & input); bitMask <<= 1; ... |
double | minMax(double v, double min, double max) min Max return Math.max(min, Math.min(max, v));
|
int | minMax(int i) min Max if (i < 0) { return 0; } else if (i > 255) { return 255; } else { return i; |
int | minmax(int min, int max, int now) minmax if (now < min) return min; if (now > max) return max; return now; |