java - Integer.parseint() Fails with Input String Greater than 9 -


i trying convert string int using integer.parseint() - works fine input string of "9" fails when input string reaches 10:

system.out.println("problem int chars:" + bf2tokens[0].trim()); system.out.println("problem int bytes:" + bf2tokens[0].trim().getbytes()); int n = integer.parseint(bf2tokens[0].trim()); 

the output:

problem int chars:10 problem int bytes:[b@4f57011e exception in thread "main" java.lang.numberformatexception: input string: "10" @ java.lang.numberformatexception.forinputstring(numberformatexception.java:65) @ java.lang.integer.parseint(integer.java:492) @ java.lang.integer.parseint(integer.java:527) @ index.main(index.java:281) 

i have tried integer.valueof() without success.

any suggestions might occurring here?

many thanks.

the problem special(unprintable) character

here output question itself. please have again @ value of bf2tokens[0].

there special(unprintable) character in string shown in below output posted you.

problem int chars:1�0 problem int bytes:[b@4f57011e exception in thread "main" java.lang.numberformatexception: input string: "1�0" @ java.lang.numberformatexception.forinputstring(numberformatexception.java:65) @ java.lang.integer.parseint(integer.java:492) @ java.lang.integer.parseint(integer.java:527) @ index.main(index.java:281) 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -