Hi,
I have good outputt, but can't complete this : The sort() method should sort the array of numbers from highest to lowest. Does anybody know why ??
package com.codegym.task.task08.task0826;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
/*
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());
}
// ArrayList<Integer> arr = new ArrayList<Integer>(Arrays.asList(array));
sort(array);
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);
for(int i=0;i<20;i++){
array[i]=array[19-i];
}
}
}