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

Asked 1 years ago, Updated 1 years ago, 71 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.