code: public static double[] Normalize(int[] values){
          int sum = 0;
          for (int i = 0; i < values.length; i++) {
              sum += values[i];
          }
          
          double[] norm = new double[values.length];
          for (int i = 0; i < norm.length; i++) {
              norm[i] = values[i] / (double)sum;
          }
          
          return norm;
      }
docs: Normalize histogram.
  @param values Values.
  @return Normalized histogram.