0
У меня проблема с копированием массива, и я посмотрел, но не могу понять, как избавиться от моего outofboundsexception. Помощь была бы оценена.Как исправить ArrayIndexOutOfBoundsException
import java.util.Arrays;
public class project {
public static void main(String[] args) {
int [] array = {1, 8, 9, 6, 7, 3, 4, 5, 10, 2};
int [] sortedArray = {array.length};
System.arraycopy(array, 0, sortedArray, 0, array.length);
Arrays.sort(sortedArray);
System.out.println("Before the sort: " + Arrays.toString(array));
System.out.println("After the sort: " + Arrays.toString(sortedArray));
}
}