如何在java中按降序对数组进行排序?

时间:2016-09-12 08:04:35

标签: java arrays function sorting collections

我在运行此数组时按降序排序值。

Double p[] = new Double[25];
for (int i = 0; i < size; i++) {
    gridlet = (Gridlet) list.get(i);
    p[t] = gridlet.getActualCPUTime();
    t++;
    Arrays.sort(p);
    Arrays.sort(p, Collections.reverseOrder());
    System.out.print(p[i]);
}

它给出了这些错误..

java.lang.NullPointerException
    at java.util.ComparableTimSort.countRunAndMakeAscending(Unknown Source)
    at java.util.ComparableTimSort.sort(Unknown Source)
    at java.util.Arrays.sort(Unknown Source)
    at GridExp.MaxMin.printGridletList(MaxMin.java:460)
    at GridExp.MaxMin.main(MaxMin.java:299)

请帮帮我..

0 个答案:

没有答案