public void merge(int a1[], int a2[], int n1, int n2) {
// code here
int i = 0, j = 0, k = n1 - 1;
while (i <= k && j < n2) {
if (a1[i] < a2[j])
i++;
else {
int temp = a2[j];
a2[j] = a1[k];
a1[k] = temp;
j++;
k--;
}
}
Arrays.sort(a1);
Arrays.sort(a2);
}