public void mergeSortedArray(int[] A, int m, int[] B, int n) {
int i = m-1, j = n-1, index = m + n - 1;
//从最后一位开始搞
while (i >= 0 && j >= 0) {
if (A[i] > B[j]) {
A[index--] = A[i--];
} else {
A[index--] = B[j--];//谁大 index--放谁
}
//如果B数组完了那剩下的都是我A的了
while (i >= 0) {
A[index--] = A[i--];
}
//如果A数组完了那剩下的都是我B的了
while (j >= 0) {
A[index--] = B[j--];
}
}