I can't validate the fourth condition. "The sort() method must sort the array of numbers from highest to lowest."
In the "recommendation from your mentor" it says:
"Verify that the tri() method is able to sort arrays of different lengths."
I've tested with an array of eight numbers and it works too, so I don't see what the problem is...
package fr.codegym.task.task08.task0826;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Cinq gagnants
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader lecteur = new BufferedReader(new InputStreamReader(System.in));
int[] tableau = new int[20];
for (int i = 0; i < tableau.length; i++) {
tableau[i] = Integer.parseInt(lecteur.readLine());
}
tri(tableau);
System.out.println(tableau[0]);
System.out.println(tableau[1]);
System.out.println(tableau[2]);
System.out.println(tableau[3]);
System.out.println(tableau[4]);
}
public static void tri(int[] tableau) {
//écris ton code ici
for (int i = tableau.length-1 ; i > 1 ; i--){
for (int j = 0 ; j < i-1 ; j++){
if (tableau[j+1] > tableau[j]){
int temp = tableau[j+1];
tableau[j+1] = tableau[j];
tableau[j] = temp;
}
}
}
}
}