private int[] mergeSort(int[] a ) {
        if(a.length == 1) return a;

        int middle = a.length / 2;
        int[] left = new int[middle];
        int[] right = new int[a.length - middle];
        System.arraycopy(a, 0, left, 0, middle);
        System.arraycopy(a, middle, right, 0, a.length - middle);
        return merge(mergeSort(left), mergeSort(right));
    }