List of utility methods to do Number Min Value
int | minMax(int val, int min, int max) min Max if (val < min) val = min; if (val > max) val = max; return val; |
int | minMax(int value, int min, int max) min Max return Math.max(min, Math.min(max, value));
|
long | minMax(long x, long y, boolean max) min Max if (max) { return (x > y ? x : y); } else { return (x < y ? x : y); |
Long | minMaxInt(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) { ... |
double | minMaxNormalize(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);
|
double | minNot0(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; ... |
int | minNotMinus1(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; ... |
long | minOfThree(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; |
int | minP(int a, long b) min P return (a < b) ? a : (int) Math.max(0, b); |
int | minPos(int a, int b) min Pos if (a < 0) { return b; if (b < 0) { return a; return Math.min(a, b); |