Here you can find the source of normalize(double[] vals)
public static final void normalize(double[] vals)
//package com.java2s; // License as published by the Free Software Foundation; either public class Main { public static final void normalize(double[] vals) { double total = 0.0; for (int i = 0; i < vals.length; i++) total += vals[i];/* w w w. j a v a 2s .c o m*/ for (int i = 0; i < vals.length; i++) vals[i] = vals[i] / total; } }