我正在尝试对2维数组进行排序,以进行遗传算法总体排名。我使用了Arrays.sort()方法。它适用于10个人口,但是当我尝试添加人口数量时。它停止并发送错误消息
this is the error message that i got:
"Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: "n', Size: "n"
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)"
does it caused by the default initial capacity at Arraylist.class?
private静态最终int DEFAULT_CAPACITY = 10;
please help to find out this problem, thank you