Here you can find the source of addAverage(List
public static List<Object[]> addAverage(List<Object[]> list, int InColumn1, int InColumn2, int resultColumn)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /** InColumn1 / InColumn2 = resultColumn. ResultColumn will be a double. */ public static List<Object[]> addAverage(List<Object[]> list, int InColumn1, int InColumn2, int resultColumn) { for (Object[] objects : list) { // TODO check math rounding double div = Double.valueOf(objects[InColumn1].toString()); double div2 = Double.valueOf(objects[InColumn2].toString()); if (div2 != 0) { objects[resultColumn] = div / div2; }// w ww.j a va 2s. c o m } return list; } }