Exception in thread “Thread-2”
java.lang.NumberFormatException: For
input string: “3”
int test = Integer.parseInt(result[0]);
This is the error I keep getting when I’m trying to convert “3” to an integer. Well I’m receiving this “3” through a RS-232 port, so maybe this is what is causing the error.
If anybody has any idea what could be causing this it would be appreciated.
What is the data type of result[0]? If it’s a string, are you sure there are no spaces or new lines around it?
Try
result[0].trim()