je ne comprends pas pourquoi ma méthode ne fonctionne pas ? votre avis ?
package fr.codegym.task.task07.task0728;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
/*
Par ordre décroissant
*/
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 < 20; i++) {
tableau[i] = Integer.parseInt(lecteur.readLine());
}
tri(tableau);
for (int x : tableau) {
System.out.println(x);
}
}
public static void tri(int[] tableau) {
//écris ton code ici
int[] trie= new int[20];
trie = tableau ;
Arrays.sort(trie);
for(int i=0; i<20;i++){
tableau[i]=trie[19-i];
}
}
}