Here you can find the source of normalize(double[] doubles)
public static double[] normalize(double[] doubles)
//package com.java2s; //License from project: GNU General Public License public class Main { public static double[] normalize(double[] doubles) { double sum = 0; for (double d : doubles) { sum += d;//from w w w.j a v a2s. c o m } for (int i = 0; i < doubles.length; i++) { doubles[i] /= sum; } return doubles; } }