min / max Methoden

This commit is contained in:
ngb
2022-01-06 09:00:01 +01:00
parent ba750a5189
commit 881c6a45e8

View File

@@ -156,6 +156,22 @@ public class Constants {
// Mathematische Funktionen
public static double min( double... numbers ) {
double min = Double.MAX_VALUE;
for( int i = 0; i < numbers.length; i++ ) {
min = Math.min(min, numbers[i]);
}
return min;
}
public static double max( double... numbers ) {
double max = Double.MIN_VALUE;
for( int i = 0; i < numbers.length; i++ ) {
max = Math.max(max, numbers[i]);
}
return max;
}
/**
* Ermittelt den Absolutbetrag der Zahl <var>x</var>.
*