public static double max(double[] data){
  double max=Double.NaN;
  for (int i=0; i < data.length; i++) {
    if (Double.isNaN(data[i]))     continue;
    if (Double.isNaN(max) || data[i] > max)     max=data[i];
  }
  return max;
}

public static double max ( double [ ] data ) { double max = Double . NaN ; for ( int i = 0 ; i < data . length ; i ++ ) { if ( Double . isNaN ( data [ i ] ) ) continue ; if ( Double . isNaN ( max ) || data [ i ] > max ) max = data [ i ] ; } return max ; }
find the maximum of all elements in the array , ignoring elements that are nan .
