int[] arrA={1,5,6,7,9};
int[] arrB={0,2,4,6,8,10};
int[] temp=new int[arrA.length+arrB.length];
int a=0;
int b=0;
for (int i = 0; i < temp.length ; i++) {
// int min=arrA[i];
if(a<arrA.length&&b<arrB.length){
if(arrA[a]<arrB[b]){
temp[i]=arrA[a];
a++;
}else {
temp[i]=arrB[b];
b++;
}
}else if(a<arrA.length){
temp[i]=arrA[a];
}else if(b<arrB.length){
temp[i]=arrB[b];
}
}
System.out.println(Arrays.toString(temp));
}