import java.util.*;
public class Solution {
public void merge(int A[], int m, int B[], int n) {
int[] arr = new int[m+n];
//归并排序
int i=0, j=0, k=0;
while(i<m || j<n){
//左半边取完,只用右半边
if(i>=m) arr[k++] = B[j++];
//右半边取完,只用左半边
else if(j>=n) arr[k++] = A[i++];
//谁小取谁
else if(A[i]<=B[j]) arr[k++] = A[i++];
else arr[k++] = B[j++];
}
for(i=0; i<m+n; i++){
A[i] = arr[i];
}
}
}