Here you can find the source of normalizeArray(double[] hist)
public static double[] normalizeArray(double[] hist)
//package com.java2s; //License from project: Open Source License public class Main { public static double[] normalizeArray(double[] hist) { double sum = 0.0; for (int i = 0; i < hist.length; i++) { sum += hist[i];/* ww w.j a v a 2 s. c o m*/ } if (sum > 0.0d) { for (int i = 0; i < hist.length; i++) { hist[i] = hist[i] / sum; } } return hist; } }