My code displays the numbers of passed array in decreasing order,. Still the final validation is failing. Whats the cause of fail ?
package com.codegym.task.task07.task0728;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
/*
In decreasing order
*/
public class Solution {
public static void main(String[] args) throws Exception {
Solution solution = new Solution();
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);
}*/
for (int x = (array.length -1); x >= 0; x--) {
System.out.println(array[x]);
}
}
public static void sort(int[] array) {
//write your code here
Arrays.sort(array);
}
}