[LintCode] Merge Sorted Array

public void mergeSortedArray(int[] A, int m, int[] B, int n) {
        // write your code here
        int i = m - 1;
        int j = n - 1;
        int index = m+n - 1;
        while(i >= 0 && j >= 0) {
            if(A[i] < B[j]) {
                A[index] = B[j];
                j--;
                index --;
            }
            else{
                A[index] = A[i];
                i--;
                index--;
            }
        }
        while(i >= 0){
            A[index] = A[i];
            i--;
            index--;;
        }
        while(j >= 0) {
            A[index] = B[j];
            j--;
            index--;
        }
    }