Here you can find the source of median(List
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <Y extends Comparable> Y median(List<Y> data)
//package com.java2s; //License from project: Apache License import java.util.Collections; import java.util.List; public class Main { @SuppressWarnings({ "rawtypes", "unchecked" }) public static <Y extends Comparable> Y median(List<Y> data) { Collections.sort(data);/* www.ja va 2 s .c o m*/ return data.get(data.size() / 2); } }