public static double mad(int[] array) {
        int m = median(array);
        for (int i = 0; i < array.length; i++) {
            array[i] = abs(array[i] - m);
        }

        return median(array);
    }
@Test
    public void testMad() {
        System.out.println("mad");
        double[] data = {1, 1, 2, 2, 4, 6, 9};
        assertEquals(1.0, MathEx.mad(data), 1E-5);
    }