java arrayCopy

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,布布扣,bubuko.com

java arrayCopy

上一篇:Java集合的线程安全用法


下一篇:[C++程序设计]全局,局部变量