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

doublefindMin(double newNumber, double currentMin)
Return the min between 2 numbers.
return Double.isNaN(currentMin) ? newNumber : currentMin > newNumber ? currentMin : newNumber;
intfindMin(int a, int b, int c, int d)
find Min
int result = Math.min(a, b);
result = Math.min(result, c);
result = Math.min(result, d);
return result;
doublefindMinAngularDistance(double angle1, double angle2)
Finds the minimum angular distance between two angles.
double angDistance = 0.0;
if (Math.signum(angle2) == Math.signum(angle1)) {
    angDistance = Math.abs(angle2 - angle1);
} else {
    double sumAngle = Math.abs(angle1) + Math.abs(angle2);
    angDistance = Math.min(sumAngle, 360 - sumAngle);
return angDistance;
...
doublemin(final double p_first, final double p_second, final double p_third)
returns the minimum of three elemens
return Math.min(Math.min(p_first, p_second), p_third);
Objectmin(Comparable c1, Comparable c2)
Null safe comparison of Comparables.
if (c1 != null && c2 != null) {
    return c1.compareTo(c2) < 1 ? c1 : c2;
} else {
    return c1 != null ? c1 : c2;
Objectmin(Comparable c1, Comparable c2)
min
if (c1 != null && c2 != null) {
    return c1.compareTo(c2) < 1 ? c1 : c2;
} else {
    return c1 != null ? c1 : c2;
Doublemin(Double a, Double b)
Like Math#min but null safe.
if (a == null) {
    return b;
} else if (b == null) {
    return a;
} else {
    return Math.min(a, b);
doublemin(double a, double b)
Binary min, without handling of special values.
return a <= b ? a : b;
doublemin(double a, double b)
min
return a > b ? b : a;
doublemin(double a, double b)
min
return Math.min(a, b);