code: public static void normalize(double[] doubles) {
  
      double sum = 0;
      for (int i = 0; i < doubles.length; i++) {
        sum += doubles[i];
      }
      normalize(doubles, sum);
    }
docs: Normalizes the doubles in the array by their sum.
  
  @param doubles the array of double
  @exception IllegalArgumentException if sum is Zero or NaN