Here you can find the source of median00(Collection
public static <T extends Comparable<? super T>> T median00(Collection<T> coll)
//package com.java2s; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; public class Main { public static <T extends Comparable<? super T>> T median00(Collection<T> coll) { if (coll.isEmpty()) { return null; } else {/*from w w w.ja v a 2 s. c o m*/ List<T> copy = new ArrayList<T>(coll); Collections.sort(copy); int index = (copy.size() - 1) / 2; return copy.get(index); } } }