public void merge(int a[], int m, int b[], int n) {
        int aIndex = m - 1, bIndex = n - 1;

        for (int i = m + n - 1; i >= 0; i --) {
            Integer aItem = aIndex >= 0 ? a[aIndex] : null;
            Integer bItem = bIndex >= 0 ? b[bIndex] : null;
            boolean fromB = false;

            if (aIndex < 0) {
                fromB = true;
            } else if (bIndex < 0) {
                fromB = false;
            } else if (a[aIndex] < b[bIndex]) {
                fromB = true;
            } else {
                fromB = false;
            }

            if (fromB) {
                a[i] = bItem;
                bIndex --;
            } else {
                a[i] = aItem;
                aIndex --;
            }
        }
    }