Hi. I know that the loop is only for 5 times and this is because when I am trying the program it's just waste of time to try in every time with 20 examples. And my program work correctly but I have to delete the lines of code:
for (int x : array) {
System.out.println(x);
}
So imho I did everything good and program is sorting the numbers in decreasing order but I just want to pass the task so can you help me with that?package com.codegym.task.task07.task0728;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
/*
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[5];
for (int i = 0; i < 5; i++) {
array[i] = Integer.parseInt(reader.readLine());
}
sort(array);
for (int x : array) {
System.out.println(x);
}
}
public static void sort(int[] array) {
//write your code here
Arrays.sort(array);
for(int i = array.length -1; i >= 0; i--){
System.out.println(" " + array[i]);
}
}
}