Here you can find the source of absAvg(double[] inputArray, int divisions, int cap)
public static double absAvg(double[] inputArray, int divisions, int cap)
//package com.java2s; //License from project: Open Source License public class Main { public static double absAvg(double[] inputArray, int divisions, int cap) { double result = 0; int count = inputArray.length; if (count > cap) { double[][] parts = new double[count][]; for (int i = 0; i < divisions; i++) { int start = (count * i) / divisions; int end = (count * (i + 1)) / divisions; int length = end - start; parts[i] = new double[length]; for (int j = 0; j < length; j++) { parts[i][j] = inputArray[j + start]; }/*from w w w . ja va 2s.c om*/ result += absAvg(parts[i], divisions, cap); } result /= divisions; } else { for (double i : inputArray) { result += Math.abs(i); } result /= count; } //System.out.println(result); return result; } }