Here you can find the source of maxLikelihood(int[] i, long[] Xi)
public static double maxLikelihood(int[] i, long[] Xi)
//package com.java2s; //License from project: Open Source License public class Main { public static double maxLikelihood(int[] i, long[] Xi) { double sum = 0; for (int x = 0; x < i.length; x++) { sum += i[x] * Xi[x];/*from w ww .java 2s .co m*/ } double n = getN(Xi); return ((1d / n) * sum); } private static long getN(long[] Xi) { long n = 0; for (long aXi : Xi) { n += aXi; } return n; } }