Java examples for Collection Framework:Array Copy
copy Array Range
//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" }; int startIndex = 2; int endIndex = 2; System.out.println(java.util.Arrays.toString(copyArrayRange(arr, startIndex, endIndex))); }/*w w w. ja v a 2 s. c om*/ public static String[] copyArrayRange(String[] arr, int startIndex, int endIndex) { String[] arrNew = Arrays.copyOfRange(arr, startIndex, endIndex); return arrNew; } }