diff flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java @ 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 2b4f78ccfbaa
children e8a4d2fd25cc
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