Why the range to be copied does not include the array element at final index?
Example:
class ArrayCopyOfDemo { public static void main(String[] args) { char[] copyFrom = {'d', 'e', 'c', 'a', 'f', 'f', 'e', 'i', 'n', 'a', 't', 'e', 'd'}; char[] copyTo = java.util.Arrays.copyOfRange(copyFrom, 2, 9); System.out.println(new String(copyTo)); } } Results: "caffein"
(The range to be copied does not include the array element at index 9 (which contains the character a).
Source: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
Thank you very much for your answers!
String.substringfor instance, etc. etc.copyOfRange(source, start, start + length)