boon/src/main/java/org/boon/primitive/Lng.java
public static long median(long[] values, final int start, final int length) {
        long[] sorted = new long[length];
        System.arraycopy(values, start, sorted, 0, length);
        Arrays.sort(sorted);

        if (length % 2 == 0) {
            int middle = sorted.length / 2;
            double median = (sorted[middle-1] + sorted[middle]) / 2.0;
            return Math.round(median);
        } else {
            return sorted[sorted.length / 2];
        }
    }
public static long median(long[] values, final int start, final int length) {
        long[] sorted = new long[length];
        System.arraycopy(values, start, sorted, 0, length);
        Arrays.sort(sorted);

        if (length % 2 == 0) {
            int middle = sorted.length / 2;
            double median = (sorted[middle-1] + sorted[middle]) / 2.0;
            return Math.round(median);
        } else {
            return sorted[sorted.length / 2];
        }
    }
Calculate Median
@param values values
@param start start
@param length length
@return median