public class ContactIntegerArray {
public static int[] contact(int a[], int b[]){
int[] f = new int[a.length+b.length];
for(int i = 0 ; i < f.length; i++)
if(i < a.length)
f[i] = a[i];
else
f[i]= b[i-a.length];
return f;
}
public static void main(String[] args) {
int a[] = {1,3,4,7};
int b[] = {2,3,5};
int c[] =ContactIntegerArray.contact(a, b);
}
}
创建新数组,长度为两个之和,然后迭代添加吧
再增加一个数组,然后把他们存进去不就好了?