philippabele / java-masterclass

0 stars 0 forks source link

Section 9 ex 42 Arrays Challenge #59

Closed philippabele closed 1 year ago

philippabele commented 1 year ago

In this challenge, I want you to: 

Create a program using arrays, that sorts a list of integers, in descending order.  Descending order means from highest value to lowest.  In other words, if the array has the values 50, 25, 80, 5, and 15, your program should   return an array, with the values in the descending order: 80, 50, 25, 15, and 5. 

First, create an array of randomly generated integers.   Print the array before you sort it. And print the array after you sort it.  You can choose to create a new sorted array, or just sort the current array.  I showed you how to use the Arrays.sort method,   but that sorts from lowest to highest. This challenge is for you to sort in reverse, or descending order.

In addition, you should use the Arrays.toString method,
to print out your array before, and after sorting.  If you want to, you can make a copy of the array before sorting.