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
🌐
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

Sorting an int[] arr in reverse order
just sort it from largest to smallest instead of smallest to largest. There are tons of sorting algos, but the easiest is bubble sort. More on reddit.com
🌐 r/javahelp
22
7
July 1, 2022
Sorting an int[] array in descending order
Why can't you just sort and reverse? More on reddit.com
🌐 r/learnjava
12
5
August 17, 2018
How to do descending order in selection sort program of Java....
use a reverse loop at the end More on reddit.com
🌐 r/ICSE
5
1
March 12, 2024
Sorting array list without using .sort in Java
Note: You don’t need to use Arrays.sort or Collections.sort for solving this task. In fact, using these sorting libraries can make your code inefficient. What this is suggesting is that you don't need to sort the whole list (using a premade or your own sorting algorithm) at any point. Instead, you maintain the list in decreasing order all the time. So always when adding items to the bag, you iterate the existing items and insert the new item in the correct position according to the wanted order. More on reddit.com
🌐 r/learnjava
2
1
October 2, 2022
🌐
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 - This is passed in as a second parameter in the sort() method so that the sorted array can be rearranged in descending order. Happy coding! ... On Skillshare Computer Science 101: Master the Theory Behind Programming Kurt Anderson 4.3 out of 5 stars (72) from 72 ratings 6h 19m 6 hours 19 minutes Beginner View course (opens in a new tab) On Udemy Java 8 Interview Questions Preparation Course KnowledgePowerhouse !
🌐
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.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-program-to-sort-the-array-elements-in-descending-order
Java Program to Sort the Elements of an Array in Descending Order - GeeksforGeeks
August 19, 2026 - The Collections.reverseOrder() method returns a comparator that sorts elements in descending order. It can be used with Arrays.sort() for arrays of wrapper classes such as Integer[]. Collections.reverseOrder() works with objects, not primitive types.
Find elsewhere
🌐
Medium
medium.com › @AlexanderObregon › sorting-numbers-in-descending-order-with-java-arrays-without-built-in-methods-ad1888bc1edb
Sorting Numbers in Descending Order with Java Arrays Without Built In Methods
July 25, 2025 - This version uses a do-while loop to keep sorting until no swaps are needed. That signals the array is fully sorted. On each pass, the loop walks the array from left to right and compares neighbors. If the value on the left is smaller than the one on the right, it’s out of order for descending sort, so it gets swapped.
🌐
W3Schools
w3schools.com › java › ref_arrays_sort.asp
Java Arrays sort() Method
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Practice Problems Java Server Java Syllabus Java Study Plan Java Interview Q&A ... The sort() method sorts an array in ascending order.
🌐
W3Schools
w3schools.com › java › java_sort_list.asp
Java Sort a List - List Sorting
Sort a Java list alphabetically or numerically with Collections.sort().
🌐
Reddit
reddit.com › r/learnjava › sorting an int[] array in descending order
r/learnjava on Reddit: Sorting an int[] array in descending order
August 17, 2018 -

Hello,

I am here after doing some research.

In this stack overflow article, it seems that they've settled on how to sort an array, but only in ascending order. Also, it is showed how to sort an Integer array in ascending order, but not an int[] array in ascending order, unless I am missing the answer. I'm looking for a way to sort an int[] array in descending order, without having to use while and for loops.

Sorry if this has been asked and answered before, I searched the sub and couldn't find it.

Here's my code so far:

import java.util.Arrays;

public class Main {
  
    public static void main(String[] args) {
        int[] array = {4,3,5,7,2,9,8,1,10,6};
        sortArray(array);
     }

    public static void sortArray(int[] array) {
        Arrays.sort(array);
        for(int i=0; i<array.length; i++) {
            System.out.println(array[i]);
        }
    }
}    

Edit, for posterity:

Thank you to a few different sources, u/PointB1ank being one of them.

Solution with comments:

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        //Initiate array
        int[] array = {4,3,5,7,2,9,8,1,10,6};
        
        //Use java.util.Arrays; to sort array in ascending order
        Arrays.sort(array);
        //Use reverseArray method to reverse the array so it is now descending
        reverseArray(array);

        //Print the reversed array
        for(int i = 0; i<array.length; i++){
            System.out.println(array[i]);
        }

    }

    public static int[] reverseArray(int[] array) {
        //1st iteration: i = 0
        //2nd iteration: i = 1
        //3rd iteration: i = 2
        //4th iteration: i = 3
        //5th iteration: i = 4
        for (int i = 0; i < array.length / 2; i++) {

            //1st iteration: temp = 0
            //2nd iteration: temp = 1
            //3rd iteration: temp = 2
            //4th iteration: temp = 3
            //5th iteration: temp = 4
            int temp = array[i];

            //1st iteration: value at index 0 = value at index 10-0-1 or 9
            //2nd iteration: value at index 1 = value at index 10-1-1 or 8
            //3rd iteration: value at index 2 = value at index 10-2-1 or 7
            //4th iteration: value at index 3 = value at index 10-3-1 or 6
            //5th iteration: value at index 4 = value at index 10-4-1 or 5
            array[i] = array[array.length - i - 1];

            //1st iteration: value at index 10-0-1 = 0
            //2nd iteration: value at index 10-1-1 = 1
            //3rd iteration: value at index 10-2-1 = 2
            //4th iteration: value at index 10-3-1 = 3
            //5th iteration: value at index 10-4-1 = 4
            array[array.length - i - 1] = temp;
        }
        //return array in descending order
        return array;
    }
}
🌐
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 - In the above example, a user-defined method sortArrayInDsc() is created that arranges the elements of the array in descending order. The contiguous part of an array is known as a subarray.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › util › List.html
List (Java Platform SE 8 )
July 21, 2026 - Temporary storage requirements vary from a small constant for nearly sorted input arrays to n/2 object references for randomly ordered input arrays. The implementation takes equal advantage of ascending and descending order in its input array, and can take advantage of ascending and descending ...
🌐
TutorialsPoint
tutorialspoint.com › java › util › arrays_sort_int.htm
Java Arrays sort(int[] a) Method
The Java Arrays sort(int[] a) method sorts the specified array of ints into ascending numerical order. This method using a Dual-Pivot Quicksort algorithm which breaks the array into subarrays, sorted them and then merged to give a sorted array.
🌐
LeetCode
leetcode.com › problems › check-if-array-is-sorted-and-rotated
Check if Array Is Sorted and Rotated - LeetCode
Can you solve this real interview question? Check if Array Is Sorted and Rotated - Given an array nums, return true if the array was originally sorted in non-decreasing order, then rotated some number of positions (including zero). Otherwise, return false. There may be duplicates in the original array.
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-sort-an-arraylist-in-descending-order-in-java
How to sort an ArrayList in Descending Order in Java - GeeksforGeeks
December 11, 2018 - This sort() method takes the collection to be sorted and Collections.reverseOrder() as the parameter and returns a Collection sorted in the Descending Order. Collections.reverseOrder() acts as the comparator in this method.
🌐
PREP INSTA
prepinsta.com › home › top 100 codes
Top 100 Codes » PREP INSTA
1 month ago - Minimum no. of operations required to make an array palindrome – C | C++ | Java | Python · Median of 2 sorted arrays of equal size – C | C++ | Java | Python
🌐
Coderanch
coderanch.com › t › 395842 › java › Reverse-sort-array
Reverse sort of array (Beginning Java forum at Coderanch)
March 9, 2004 - If the elements of the array are primitives, then you're stuck. However, if they are Objects, then you can use sort(array, comparator), where comparator is an object that implements the Comparator interface, sorting it in whatever order you want. (This is all in the API docs for java.util.Arrays).
🌐
W3Schools
w3schools.com › python › ref_func_sorted.asp
Python sorted() Function
Python DSA Lists and Arrays Stacks Queues Linked Lists Hash Tables Trees Binary Trees Binary Search Trees AVL Trees Graphs Linear Search Binary Search Bubble Sort Selection Sort Insertion Sort Quick Sort Counting Sort Radix Sort Merge Sort