Java examples for Collection Framework:Array Copy
copy Array using Arrays.copyOf method
//package com.java2s; import java.util.Arrays; public class Main { public static void main(String[] argv) throws Exception { String[] arr = new String[] { "1", "abc", "level", null, "java2s.com", "asdf 123" }; System.out.println(java.util.Arrays.toString(copyArray(arr))); }//from www .ja v a 2s . com public static String[] copyArray(String[] arr) { String[] arrNew = Arrays.copyOf(arr, arr.length); return arrNew; } }