How do I sort the arrays in descending order in Java?

Asked 2 years ago, Updated 2 years ago, 78 views

You can just sort the arrangement in ascending order. Is there an easy way to sort in descending order?

sorting int java array

2022-09-22 22:17

1 Answers

sort(T[] a, Comparator<? super T> c) 

Arrays.sort(a, Collections.reverseOrder());

Do it like this.


2022-09-22 22:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.