Here you can find the source of normalizedBySum(double[] values)
public static double[] normalizedBySum(double[] values)
//package com.java2s; //License from project: Open Source License public class Main { public static double[] normalizedBySum(double[] values) { double[] normedValues = new double[values.length]; double sum = 0.0; for (int k = 0; k < values.length; k++) { sum += values[k];/*from w ww . j av a 2 s.c om*/ } for (int k = 0; k < values.length; k++) { normedValues[k] = values[k] / sum; } return normedValues; } }