Java - converting String in array to double

Posted by cc0 on Stack Overflow See other posts from Stack Overflow or by cc0
Published on 2010-03-16T12:09:17Z Indexed on 2010/03/16 12:16 UTC
Read the original article Hit count: 221

Filed under:
|

I'm stuck with this pretty silly thing;

I got a textfile like this;

Hello::140.0::Bye

I split it into a string array using;

LS = line.split("::");

Then I try to convert the array values containing the number to a double, like this;

Double number = Double.parseDouble(LS[1]);

But I get the following error message;

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

Does anyone have any idea why this doesn't work?

© Stack Overflow or respective owner

Related posts about java

Related posts about arrays