标签: java
我有一个至少包含三个元素的字符串数组。我想将第三个和所有后续元素复制到一个新数组中。如何最有效地实现这一目标?
答案 0 :(得分:36)
String[] arr = {"One", "Two", "Three", "Four", "Five"}; String[] arr2 = Arrays.copyOfRange(arr, 2, arr.length); //Note third param is exclusive