Here you can find the source of median(List
public static <T> T median(List<T> data)
//package com.java2s; //License from project: Open Source License import java.util.Collections; import java.util.List; public class Main { public static <T> T median(List<T> data) { Collections.sort((List) data); int n = data.size(); return data.get(n / 2); }//from w ww .j a va 2 s . co m }