The last condition is not satisfied.
package com.codegym.task.task07.task0728;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
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[20];
for (int i = 0; i < 20; i++) {
array[i] = Integer.parseInt(reader.readLine());
}
sort(array);
}
public static void sort(int[] array) {
int[] array2 = new int[20];
for(int i=0;i<20;i++){
int max=array[i];
for(int j=i+1;j<20;j++){
if (array[j]>max){
max=array[j];
}
}
System.out.println(max);
}
}
}