When I run the program it outputs the five highest numbers, but it's not passing the sort task. Your help is appreciated.
package com.codegym.task.task08.task0826;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.*;
/*
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);
/*
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) {
//write your code here
Arrays.sort(array);
int[] top5 = Arrays.copyOfRange(array, array.length-5,array.length);
int newArr[] = array.clone();
for (int i = 0; i < top5.length; i++)
{
top5[i] = newArr[newArr.length - 1 - i];
}
//Arrays.sort(top5, Collections.reverseOrder());
for (int j = 0; j<top5.length; j++)
{
System.out.println(top5[j]);
}
//
}
}