public static void normalize(double[] doubles) {

    double sum = 0;
    for (int i = 0; i < doubles.length; i++) {
      sum += doubles[i];
    }
    normalize(doubles, sum);
  }
public static void normalize ( double [ ] doubles ) { double sum = 0 ; for ( int i = 0 ; i < doubles . length ; i ++ ) { sum += doubles [ i ] ; } normalize ( doubles , sum ) ; }
Normalizes the doubles in the array by their sum.

@param doubles the array of double
@exception IllegalArgumentException if sum is Zero or NaN