Collections.reverse requires a list, not an array.
Code
public static void main(String []args){
Random ranNumber = new Random();
Integer[] myIntArray = new Integer[100];
for (int i = 0; i < myIntArray.length; i++) {
myIntArray[i] = ranNumber.nextInt(99);
}
Arrays.sort(myIntArray);
System.out.println(Arrays.asList(myIntArray));
Collections.reverse(Arrays.asList(myIntArray));
System.out.println(Arrays.asList(myIntArray));
}
Note that int changed to Integer.
I advise you to check out documentation if your understanding of a function isn't in line with its output.
https://docs.oracle.com/javase/7/docs/api/java/util/Collections.htmlTrial in error in programming is rarely the solution, do your research : )
This article will explain why Integer is needed:
https://www.w3schools.com/java/java_wrapper_classes.aspThis post was edited by Kippet on Nov 4 2020 10:01am