Here you can find the source of getAverage(List
public static <T extends Number> double getAverage(List<T> numbers)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <T extends Number> double getAverage(List<T> numbers) { double avg = 0; for (T i : numbers) avg += i.doubleValue();/* w ww . j a v a 2s . co m*/ return avg / numbers.size(); } }