Behold code that one hundred percent solves what it's asking for but doesn't sort arrays of a size different than 20.
package com.codegym.task.task08.task0826;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Five winners
*/
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 < array.length; i++) {
array[i] = Integer.parseInt(reader.readLine());
}
sort(array);
// for (int j: array){ System.out.println(j); } undo the comment line and delet this sentence to see this should register and work as requested.
System.out.println(array[0]);
System.out.println(array[1]);
System.out.println(array[2]);
System.out.println(array[3]);
System.out.println(array[4]);
}
public static void sort(int[] array) {
Arrays.sort(array);
int[] finalArray = new int[20];
for (int i=0; i<array.length; i++){
int num = 19 - i;
finalArray[i] = array[num];
}
for (int i=0; i<array.length; i++){ array[i] = finalArray[i]; }
}
}