Java Utililty Methods Number Min Value

List of utility methods to do Number Min Value

Description

The list of methods to do Number Min Value are organized into topic(s).

Method

intminInteger(Integer a, Integer b)
min Integer
if (a == null || b == null) {
    return Integer.MIN_VALUE;
return Math.min(a, b);
BooleanminLength(String field, Integer from)
min Length
return field.length() >= from;
booleanminLength(String value, int min)

Checks if the value's length is greater than or equal to the min.

return (value.length() >= min);
StringminLengthExpression(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);
doubleminLimit(double d, double limit)
min Limit
return d < limit ? limit : d;
floatminLimit(float value, float min)
min Limit
return value < min ? min : value;
intminLog2(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;
...
doubleminMax(double v, double min, double max)
min Max
return Math.max(min, Math.min(max, v));
intminMax(int i)
min Max
if (i < 0) {
    return 0;
} else if (i > 255) {
    return 255;
} else {
    return i;
intminmax(int min, int max, int now)
minmax
if (now < min)
    return min;
if (now > max)
    return max;
return now;