Can't figure this one out... Where am I doing wrong?
package com.codegym.task.task07.task0728;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
/*
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());
}
sort(array);
for (int x : array) {
System.out.println(x);
}
}
public static void sort(int[] array) {
int[] numbersCopy = Arrays.copyOf(array, array.length);
Arrays.sort(numbersCopy);
for (int i = 19; i >= 0; i--) {
for (int j = 0; j < 20; j++) {
array[j] = numbersCopy[i];
}
}
}
}