Using Arrays.copyOf to copy an array : Array Copy Clone « Collections « Java Tutorial

import java.util.Arrays;

public class ArrayCopy {
  public static void main(String args[]) {
    System.out.printf("Before (original)\t%s%n", Arrays.toString(args));
    String copy[] = Arrays.copyOf(args, 4);
    System.out.printf("Before (copy)\t\t%s%n", Arrays.toString(copy));
    copy[0] = "A";
    copy[1] = "B";
    copy[2] = "C";
    copy[3] = "D";
    System.out.printf("After (original)\t%s%n", Arrays.toString(args));
    System.out.printf("After (copy)\t\t%s%n", Arrays.toString(copy));

9.5.Array Copy Clone
9.5.1.use Arrays.copyOf to copy array
9.5.2.Copying and Cloning Arrays
9.5.3.Doubling the size of an array
9.5.4.Array clone
9.5.5.Copy some items of an array into another array
9.5.6.Using Arrays.copyOf to copy an array
9.5.7.Copies the given array and adds the given element at the end of the new array. (long value type)