People.. help!!!!!
I'm having a little problem trying to convert String to int.
First I'm using a byte variable to read the input data.
byte data[ ] = new byte [3];
System.in.read (data);
Then I convert to String
String data_string = new String (data);
Then I convert to int
int data_int = Integer.parseInt(data_string)
Then appears a error , actually an exception <NumberFormatException>. If I use 'byte data[ ] = new byte[ 1 ]' doesn't make that error.
I don't know how to convert whitout making that exception.
Could someone help me please!
Thanx!
Trinity
Convert data types
Moderator: Board moderators
I dont know why are you reading the input like you do it.
I believe that its easier to read it like this
int n = Integer.parseInt(ReadLn(255).trim());
Where ReadLn is the method that you find here http://acm.uva.es/problemset/data/p100.java.html
Hope it helps
I believe that its easier to read it like this
int n = Integer.parseInt(ReadLn(255).trim());
Where ReadLn is the method that you find here http://acm.uva.es/problemset/data/p100.java.html
Hope it helps
Those Who Don't Know History are doomed to repeat it