You could use this to sort all kind of Objects

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

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

Arrays.sort() cannot be used directly to sort primitive arrays in descending order. If you try to call the Arrays.sort() method by passing reverse Comparator defined by Collections.reverseOrder() , it will throw the error

no suitable method found for sort(int[],comparator)

That will work fine with 'Array of Objects' such as Integer array but will not work with a primitive array such as int array.

The only way to sort a primitive array in descending order is, first sort the array in ascending order and then reverse the array in place. This is also true for two-dimensional primitive arrays.

Answer from user173973 on Stack Overflow
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › Arrays.html
Arrays (Java Platform SE 8 )
July 21, 2026 - Sorts the specified range of the array into ascending order. The range to be sorted extends from the index fromIndex, inclusive, to the index toIndex, exclusive.
🌐
GeeksforGeeks
geeksforgeeks.org › java › arrays-sort-in-java
Arrays.sort() in Java - GeeksforGeeks
Arrays.sort() is a built-in method in Java used to sort arrays in ascending order.
Published: August 27, 2026
Discussions

Java Array Sort descending? - Stack Overflow
Is there any EASY way to sort an array in descending order like how they have a sort in ascending order in the Arrays class? Or do I have to stop being lazy and do this myself :[ More on stackoverflow.com
🌐 stackoverflow.com
Sort an array in Java - Stack Overflow
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 lowest to highest value and then ... More on stackoverflow.com
🌐 stackoverflow.com
Java: Is Arraylist better than Arrays?
The biggest difference is that you can add to and remove from a list, whereas arrays have a fixed size. More on reddit.com
🌐 r/learnprogramming
28
19
June 23, 2024
Sorting in Java in descending order
Write your own swapping function. Swap after arrays.sort. More on reddit.com
🌐 r/leetcode
5
1
June 9, 2022
🌐
W3Schools
w3schools.com › java › ref_arrays_sort.asp
Java Arrays sort() Method
This method sorts arrays of strings alphabetically, and arrays of integers numerically.
🌐
Florida State University
cs.fsu.edu › ~myers › cop3252 › notes › sorting.html
Sorting Arrays
class java.util.Arrays is a utility class that contains various methods for manipulating arrays, including sorting and searching
🌐
Medium
medium.com › @AlexanderObregon › javas-arrays-sort-explained-d7a2d48f1cc0
Java’s Arrays.sort() Explained | Medium
September 23, 2024 - This partitioning step is repeated recursively until the entire array is sorted. Quicksort is a comparison sort, meaning it makes decisions based on comparing elements to one another. While its worst-case time complexity is O(n²) (when the pivot is poorly chosen, leading to imbalanced partitions), this can be mitigated by techniques like choosing a random pivot or using median-of-three pivot selection. Java’s Arrays.sort() method, when sorting primitive types, does not rely on a simple Quicksort implementation.
Find elsewhere
🌐
Medium
medium.com › @reetesh043 › collection-sort-vs-arrays-sort-in-java-1528f83223c3
Medium
February 21, 2024 - Arrays.sort() is a static method provided by the Arrays utility class in Java. This method is used to sort arrays of primitive data types or objects. It works with arrays of all types, including arrays of objects.
🌐
Baeldung
baeldung.com › home › java › java array › sorting arrays in java
Sorting Arrays in Java | Baeldung
January 8, 2024 - Java’s util.Arrays.sort method provides us with a quick and simple way to sort an array of primitives or objects that implement the Comparable interface in ascending order.
🌐
DataCamp
datacamp.com › doc › java › sort
Java Array sort()
Java keywordsIntroduction To JavaJava File HandlingJava Language BasicsJava ArraysJava Object-Oriented Programming ... The Arrays.sort() method in Java is a utility provided by the java.util.Arrays class to sort arrays of various data types.
🌐
CodeGym
codegym.cc › java blog › java algorithms › how to sort an array in java
How to Sort an Array in Java
January 7, 2025 - The swap method is a utility method used to swap two elements in the Array. In the main method, an example array is created and printed before and after sorting using the quickSort method. The Comparable interface is part of the java.lang package and contains a single method:
🌐
freeCodeCamp
freecodecamp.org › news › java-sort-array-how-to-reverse-an-array-in-ascending-or-descending-order-with-arrays-sort-2
Java Sort Array – How to Reverse an Array in Ascending or Descending Order with Arrays.sort()
June 14, 2022 - Using the Arrays class in Java, you have access to various methods you can use to manipulate arrays. One of the methods we'll be using from the Arrays class is the sort() method which sorts an array in ascending order.
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.util.arrays.sort
Arrays.Sort Method (Java.Util) | Microsoft Learn
Sorts the specified range of the specified array of objects according to the order induced by the specified comparator.
🌐
Codeforces
codeforces.com › blog › entry › 7108
How to sort arrays in Java and avoid TLE - Codeforces
long[] arr = {1,2,3,5,4}; shuffleArray(arr); Arrays.sort(arr); // after sorting print arr ... void shuffleArray(long[] arr){ int n = arr.length; Random rnd = new Random(); for(int i=0; i<n; ++i){ long tmp = arr[i]; int randomPos = i + rnd.nextInt(n-i); arr[i] = arr[randomPos]; arr[randomPos] = tmp; } } ... [1] [More On Shuffling An Array Correctly](http://blog.ryanrampersad.com/2012/03/more-on-shuffling-an-array-correctly/) – blog post by Ryan Rampersad. [2] [Why java Arrays use two different sort algorithms for different types?](http://stackoverflow.com/questions/3707190/why-java-arrays-use-two-different-sort-algorithms-for-different-types) (discussion on stackoverflow.com)
🌐
TutorialsPoint
tutorialspoint.com › java › util › arrays_sort_short.htm
Java Arrays sort(short[] a) Method
Using sort() method, array is sorted and printed thereafter. package com.tutorialspoint; import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { // initialize unsorted array short arr[] = { 11, 54, 23, 32, ...
🌐
Big-O Cheat Sheet
bigocheatsheet.com
Big-O Algorithm Complexity Cheat Sheet (Know Thy Complexities!) @ericdrowell
This webpage covers the space and time Big-O complexities of common algorithms used in Computer Science. When preparing for technical interviews in the past, I found myself spending hours crawling the internet putting together the best, average, and worst case complexities for search and sorting algorithms so that I wouldn't be stumped when asked about them.
🌐
Java Tutorial HQ
javatutorialhq.com › java tutorial › java.util › arrays › sort(int[] a) method example
Java Arrays sort(int[] a) method example
October 2, 2019 - Basically the sort(int[] a) method sorts the specified array into ascending numerical order. The sort() method is overloaded in such a way that each primitive data type is handled.
🌐
Hero Vired
herovired.com › learning-hub › topics › how-to-sort-an-array-in-java
How to Sort an Array in Java - Complete Tutorial
July 23, 2024 - The other way to sort an array is to create a user-defined method. This method contains the sorting logic and can be reused multiple times in a program. ... // Java program to sort integer array in ascending order using user-defined method public class SortArrayExample { public static void main(String[] args){ // Define an integer type array int[] arr = new int[] {99, 39, 10, -9, 20, 2990, 0, -1, 13}; // Printing the original array System.out.println("The Original Array is: "); for (int num : arr) { System.out.print(num + " "); } // Invoking user-defined method sortArrayInAsc(arr, arr.length);
🌐
Unstop
unstop.com › home › blog › learn how to sort an array in java with detailed code examples
Learn How To Sort An Array In Java With Detailed Code Examples
January 7, 2025 - Use Arrays.sort(array) in Java to sort an array. It arranges elements in ascending order, whether it's numbers or objects like Strings.
🌐
Baeldung
baeldung.com › home › java › java collections › sorting in java
Sorting in Java | Baeldung
February 3, 2026 - Let’s start by sorting integer arrays first using Arrays.sort() method.