bonjour, j'ai un tableau qui contient des chaines de caractères, je veux chercher le minimum dans ce tableau, j'ai écrit ce petit code mais ça marche pas:
il me génère cette erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 int minVal = Integer.MIN_VALUE; for(int i = 0; i < listeStrings.length; i++){ int value = Integer.parseInt(listeStrings[i]); if(value > minVal) minVal = value; } System.out.println(minVal);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 Exception in thread "main" java.lang.NumberFormatException: For input string: " 1217183040" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at tableau.main(tableau.java:187)
Partager