Here you can find the source of max(double[] series)
Parameter | Description |
---|---|
series | The timeseries. |
public static double max(double[] series)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w. j a va2s . co m * Finds the maximal value in timeseries. * * @param series The timeseries. * @return The max value. */ public static double max(double[] series) { if (countNaN(series) == series.length) { return Double.NaN; } double max = Double.MIN_VALUE; for (int i = 0; i < series.length; i++) { if (max < series[i]) { max = series[i]; } } return max; } /** * Counts the number of NaNs' in the timeseries. * * @param series The timeseries. * @return The count of NaN values. */ private static int countNaN(double[] series) { int res = 0; for (double d : series) { if (Double.isInfinite(d) || Double.isNaN(d)) { res += 1; } } return res; } }