This is telling you that the String text2 contains a single space and that's it. This is not a valid integer. To handle bad input, you can use a try/catch block.
Originally posted by Jherald Lacambra:
int num = Integer.parseInt(text2);
the error generated was:
java.lang.NumberFormatException: For input string: " "