List of utility methods to do Number Min Value
float | min(final float a, final float b, final float c) Returns the minimum value of three floats. return a < b ? a < c ? a : c : b < c ? b : c;
|
int | min(final int a, final int b) Return the lesser of the two values. return (a <= b ? a : b);
|
int | min(final int a, final int b) Provides an unbranched version of min for POSITIVE ints, it does 7 operations instead of branching (which is somewhat slower, but it's mainly here for educational purposes) The original code can be found in: http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax final int ab = a - b; return a & (ab >> 31) | b & (~ab >> 31); |
double | min(final Iterable extends Number> numbers) min double min = Double.MAX_VALUE; for (final Number number : numbers) { final double value = number.doubleValue(); if (value < min) { min = value; return min; ... |
NUMBER_TYPE | min(final NUMBER_TYPE n1, final NUMBER_TYPE n2) min if (n1 == null && n2 == null) { return null; } else if (n1 == null) { return n2; } else if (n2 == null) { return n1; final int compared = compareTo(n1, n2); ... |
NUMBER_TYPE | min(final NUMBER_TYPE number1, final NUMBER_TYPE number2) min if (number1 == null && number2 == null) { return null; } else if (number1 == null) { return number2; } else if (number2 == null) { return number1; } else if (number1.doubleValue() < number2.doubleValue()) { return number1; ... |
String | min(final String string1, final String string2) Returns the shortest string. if (string1 == null) { return string2; } else if (string2 == null) { return string1; return string1.length() > string2.length() ? string2 : string1; |
float | min(float a, float b) min return a < b ? a : b;
|
float | min(float a, float b) min return (a <= b) ? a : b;
|
float | min(float a, float b, float c, float d, float e) min float m = a; m = b < m ? b : m; m = c < m ? c : m; m = e < m ? e : m; return d < m ? d : m; |