I have a string array with at least three elements. I'd like to copy the third and all subsequent elements into a new array. How can this be most efficiently achieved?
String[] arr = {"One", "Two", "Three", "Four", "Five"};
String[] arr2 = Arrays.copyOfRange(arr, 2, arr.length);
//Note third param is exclusive
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With