Here you can find the source of copyOf(String[] original, int newLength)
public static String[] copyOf(String[] original, int newLength)
//package com.java2s; public class Main { public static String[] copyOf(String[] original, int newLength) { return copyOfRange(original, 0, newLength); }//from ww w.jav a 2 s .co m public static String[] copyOfRange(String[] original, int from, int newLength) { String[] copy = new String[newLength]; newLength = Math.min(original.length - from, newLength); System.arraycopy(original, from, copy, 0, newLength); return copy; } }