append two array in java

Append two arrays

Here we simply add two arrays

Program code
public class append
{
public static void main(String arg[])
{
int []a = new int[]{1,2,3};
int []b = new int[]{4,5,6,7,8,9,10};
int []r = new int[a.length + b.length];
System.arraycopy(a,0,r,0,a.length);
System.arraycopy(b,0,r,a.length,b.length);

for(int x:r)
{
System.out.println(x);
}
}
}


Output