Here you can find the source of avg(double[] x, int start, int end)
public static double avg(double[] x, int start, int end)
//package com.java2s; //License from project: Apache License public class Main { public static double avg(double[] x, int start, int end) { if (start >= end) { return 0; }/*from w w w .jav a 2 s .com*/ return sum(x, start, end) / (end - start); } public static double sum(double[] x, int start, int end) { double sum = 0; for (int i = start; i < end; i++) { sum += x[i]; } return sum; } }