@Override
    public double d(int[] x, int[] y) {
        if (x.length != y.length) {
            throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
        }

        int dist = 0;
        for (int i = 0; i < x.length; i++) {
            int d = Math.abs(x[i] - y[i]);
            dist += Math.min(d, q-d);
        }

        return dist;
    }
@Test
    public void testDistance() {
        System.out.println("distance");
        int[] x = {3, 3, 4, 0};
        int[] y = {2, 5, 4, 3};
        LeeDistance instance = new LeeDistance(6);
        assertEquals(6.0, instance.d(x, y), 1E-9);
    }