public class Solution { public void merge(int A[], int m, int B[], int n) { if(B.length == 0){ return; }else if(A.length == 0){ A= B; return; } m--; n--; for(int i = m + n + 1 ; i >= 0 ; i-- ){ if(m >=0 && n >= 0){ if(A[m] > B[n]){ A[i] = A[m]; m--; }else{ A[i] = B[n]; n--; } }else if (n >= 0){ A[i] = B[n]; n--; } } } }