System: arraycopy(Object src, int srcPos, Object dest, int destPos, int length) : System « java.lang « Java by API






System: arraycopy(Object src, int srcPos, Object dest, int destPos, int length)

    
/*
 * Output:
 
array2: 0 1 2 3 4 0 0 0 0 0


 */

public class MainClass {
  public static void main(String args[]) {
    int array1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    int array2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    System.arraycopy(array1, 0, array2, 0, 5);
    System.out.print("array2: ");
    System.out.print(array2[0] + " ");
    System.out.print(array2[1] + " ");
    System.out.print(array2[2] + " ");
    System.out.print(array2[3] + " ");
    System.out.print(array2[4] + " ");
    System.out.print(array2[5] + " ");
    System.out.print(array2[6] + " ");
    System.out.print(array2[7] + " ");
    System.out.print(array2[8] + " ");
    System.out.println(array2[9]);
  }
}


           
         
    
    
    
  








Related examples in the same category

1.System.exit(int status)
2.System.in
3.System.in.read()
4.System.out
5.System: clearProperty(String key)
6.System: console()
7.System: currentTimeMillis()
8.System: getenv(String key)
9.System: getProperty(String name)
10.System.getProperty ("user.dir")
11.System: getProperty(String key, String def)
12.System: getProperties()
13.System.identityHashCode(Object x)
14.System: nanoTime()
15.System.setErr(PrintStream err)
16.System: setIn(InputStream in)
17.System: setOut(PrintStream err)
18.System: setProperty(String key, String value)