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

intminMax(int val, int min, int max)
min Max
if (val < min)
    val = min;
if (val > max)
    val = max;
return val;
intminMax(int value, int min, int max)
min Max
return Math.max(min, Math.min(max, value));
longminMax(long x, long y, boolean max)
min Max
if (max) {
    return (x > y ? x : y);
} else {
    return (x < y ? x : y);
LongminMaxInt(Long i1, String s, boolean max)
Compare two Int values and return min or max
Long i2 = null;
try {
    i2 = Long.parseLong(s);
} catch (NumberFormatException e) {
if (i1 == null) {
    return i2;
} else if (i2 == null) {
...
doubleminMaxNormalize(double min, double max, double value)
normalize a target value by using min-max normalization (values are scaled in 0 to 1)
return (value - min) / (max - min);
doubleminNot0(double i1, double i2)
Get min reject -1
if (i1 == 0) {
    if (i2 > 0)
        return i2;
    else
        return 0;
} else {
    if (i2 > 0 && i2 < i1)
        return i2;
...
intminNotMinus1(int i1, int i2)
Get min reject -1
if (i1 == -1) {
    if (i2 > -1)
        return i2;
    else
        return -1;
} else {
    if (i2 > -1 && i2 < i1)
        return i2;
...
longminOfThree(final long a, final long b, final long c)
min Of Three
long minimum;
minimum = a;
if (b < minimum) {
    minimum = b;
if (c < minimum) {
    minimum = c;
return minimum;
intminP(int a, long b)
min P
return (a < b) ? a : (int) Math.max(0, b);
intminPos(int a, int b)
min Pos
if (a < 0) {
    return b;
if (b < 0) {
    return a;
return Math.min(a, b);