changeset 4340:64528d2a89c4

DoubleUtil: New function to find max in an double array.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 31 Oct 2012 14:13:33 +0100
parents ff83ec9b4c0b
children d15012c99f40
files flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java	Wed Oct 31 14:09:36 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java	Wed Oct 31 14:13:33 2012 +0100
@@ -199,5 +199,15 @@
         }
         return true;
     }
+
+
+    /** In an array of doubles, search and return the maximum value. */
+    public static final double maxInArray(double[] values) {
+        double max = - Double.MAX_VALUE;
+        for (double d: values) {
+            if (d > max) max = d;
+        }
+        return max;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org