int[] a = new int[50]; int[] b = new int[50]; for (int i = 0; i < 50; i++) { a[i] = i; } for (int i = 0; i < 50; i++) { b[i] = i + 50; } int []c = new int[a.length+b.length]; System.arraycopy(a, 0, c, 0, a.length); System.arraycopy(b, 0, c, 50, b.length); //System.arraycopy(b, 0, a, 50, 50); System.out.println(java.util.Arrays.toString(c));
{
public static void main(String[]args)
{
int[]a = new int[100];
int[]b = new int[100];
for(int i=0;i<50;i++)
{
a[i]=i;
}
for(int i=0;i<50;i++)
{
b[i]=i+50;
}
System.arraycopy(b,0,a,50,50);
for(int i=0;i<a.length;i++)
{
System.out.println(a[i]);
}
}
}
int[] b = new int[50];
for (int i = 0; i < 50; i++) {
a[i] = i;
}
for (int i = 0; i < 50; i++) {
b[i] = i + 50;
}
int []c = new int[a.length+b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, 50, b.length);
//System.arraycopy(b, 0, a, 50, 50);
System.out.println(java.util.Arrays.toString(c));
在io或字符,这两部分用的比较多,
asByteBuffer(), 用这个方法能转换,
不过正规的 sun jdk API中好象没有这个,
正规的有asCharBuffer,....这些正好跟你要的相反,
楼主要的话可以跟我说,我有他们的
jar文件,你只要import就行了.
The method toString() in the type Object is not applicable for the arguments
(int[])
int[] b=new int[20];int[] c=new int[a.length+b.length];//生成可以容纳原始2个数组的空间
System.arraycopy(a,0,c,0,a.length);//拷贝第一个数组
System.arraycopy(b,0,c,a.length,b.length);//拷贝第二个数组