int[] dest = new int[0];
int[] value = {1,2};
if(value != null && value.length>0)
{
int[] tmp = dest;
dest = new int[value.length+tmp.length];
System.arraycopy(tmp, 0, dest, 0, tmp.length);
System.arraycopy(value, 0, dest, tmp.length, value.length);
}
int[] value2 = {3,4};
if(value2 != null && value2.length>0)
{
int[] tmp = dest;
dest = new int[value2.length+tmp.length];
System.arraycopy(tmp, 0, dest, 0, tmp.length);
System.arraycopy(value2, 0, dest, tmp.length, value2.length);
}
java arrayCopy
时间: 2024-10-24 18:24:17