Java examples for Collection Framework:List
get Average of Long List
//package com.java2s; import java.util.List; public class Main { public static float getAverage(List<Long> allTimes) { long total = getTotal(allTimes); return total / (float) allTimes.size(); }//ww w .j a v a 2 s.c o m public static long getTotal(List<Long> times) { long total = 0; for (Long time : times) { total = total + time; } return total; } }