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

public static double max ( double [ ] a ) { double max = Double . NEGATIVE_INFINITY ; for ( int i = 0 ; i < a . length ; i ++ ) { if ( Double . isNaN ( a [ i ] ) ) return Double . NaN ; if ( a [ i ] > max ) max = a [ i ] ; } return max ; }
returns the maximum value in the specified array .
