Sort an array in Java

后端 未结 17 1140
傲寒
傲寒 2020-11-22 04:53

I\'m trying to make a program that consists of an array of 10 integers which all has a random value, so far so good.

However, now I need to sort them in order from l

17条回答
  •  时光取名叫无心
    2020-11-22 05:18

    just FYI, you can now use Java 8 new API for sorting any type of array using parallelSort

    parallelSort uses Fork/Join framework introduced in Java 7 to assign the sorting tasks to multiple threads available in the thread pool.

    the two methods that can be used to sort int array,

    parallelSort(int[] a)
    parallelSort(int[] a,int fromIndex,int toIndex)
    

提交回复
热议问题