Please, I am lost. I would really appreciate the help. Thank you.
package com.codegym.task.task07.task0728;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
/*
In decreasing order
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int[] array = new int[20];
for (int i = 0; i < 20; i++) {
array[i] = Integer.parseInt(reader.readLine());
}
int[] newArray = new int[array.length];
newArray = sort(array);
for (int x : array) {
System.out.println(x);
}
}
public static int[] sort(int[] array) {
int[] newestArray = new int[array.length];
int[] newesttArray;
newesttArray = Arrays.sort(array);
//newesttArray = Arrays.sort(array);
for (int z = 0; z < newesttArray.length; z++) {
int current = newesttArray[newesttArray.length - z - 1];
newestArray[z] = current;
}
return newestArray;
}
}
public static int[] sort(int[] array)public static void sort(int[] array) 2. do not return anything 3. if you use an additional array (newesttArray), try copying it before exiting the method to the original array 4. in the 'for' loop use array, not newesttArray