Probleme de conversion string --> int en java
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