Here you can find the source of normalize(double[] array)
public static void normalize(double[] array)
//package com.java2s; //License from project: Open Source License public class Main { public static void normalize(double[] array) { double s = 0; double as = 0; for (int i = 0; i < array.length; ++i) { s += array[i];/*from w ww. j a v a2 s. c o m*/ as += Math.abs(array[i]); } if (as > 0) { for (int i = 0; i < array.length; ++i) { array[i] /= s; } } } }