Probleme de conversion string --> int en java
bloomingdals
-
KX Messages postés 19031 Statut Modérateur -
KX Messages postés 19031 Statut Modérateur -
Bonjour,
je n'arrête pas d'essayer de convertir une chaine de caractères en entier mais ca me retourne une exception voici mon code
public int taille(File file) throws IOException
{
Shell sh = new Shell();
File dir= new File("/root/Desktop/");
sh.setDirectory(dir);
String cmd="sed -n '$=' "+file+"";
String t=sh.command(cmd).consumeAsString();
int taille=Integer.parseInt(t);
return (taille);
}
voici le message d'erreur
Exception in thread "main" java.lang.NumberFormatException: For input string: "89"
pouriez vous m'aider svp
merci
je n'arrête pas d'essayer de convertir une chaine de caractères en entier mais ca me retourne une exception voici mon code
public int taille(File file) throws IOException
{
Shell sh = new Shell();
File dir= new File("/root/Desktop/");
sh.setDirectory(dir);
String cmd="sed -n '$=' "+file+"";
String t=sh.command(cmd).consumeAsString();
int taille=Integer.parseInt(t);
return (taille);
}
voici le message d'erreur
Exception in thread "main" java.lang.NumberFormatException: For input string: "89"
pouriez vous m'aider svp
merci
A voir également:
- Probleme de conversion string --> int en java
- Jeux java itel - Télécharger - Jeux vidéo
- Waptrick java football - Télécharger - Jeux vidéo
- Waptrick java voiture - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages