class PpeOp extends Operator {

    static Double getMAD(double[] listDoubles) {
        Double median = getMedian(listDoubles);
        double[] listMAD = new double[5];
        for (int i = 0; i < 5; i++) {
            if (listDoubles[i] != 0) {
                listMAD[i] = Math.abs(listDoubles[i] - median);
            } else {
                listMAD[i] = -1;
            }
        }
        Arrays.sort(listMAD);
        if (listMAD[1] == -1) {
            return listMAD[3];
        } else if (listMAD[0] == -1) {
            return (listMAD[2] + listMAD[3]) / 2;
        } else {
            return listMAD[2];
        }
    }

}