Help pls :Exception in thread "main" java.lang.NumberFormatException:

Hi,

The Double.parseDouble method does not seem to be working and I keep getting this error msg...can someone pls tell me what i'm doing wrong....

Exception in thread "main" java.lang.NumberFormatException: For input string: "0.0113974371229202620.06577017114914425 0.88952095260741530.93902610142076840.00.15490196078431373"

at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)

at java.lang.Double.parseDouble(Double.java:482)

at data.newLineToRead(data.java:16)

at data.data(data.java:34)

at train.main(train.java:86)

Thanks a lot

import java.io.*;

import java.util.*;

publicclass data{

privatestatic parameter par;

privatestaticdouble[][] x=newdouble[par.n()][par.D()];

publicstaticdouble[] t=newdouble[par.n()];

publicstaticvoid newLineToRead(String LineToRead,int n){

int d=0;

//System.out.println(LineToRead);

for(int i=0;i<=LineToRead.length();i++){

StringTokenizer str =new StringTokenizer (LineToRead,"/t");

while (str.hasMoreTokens()){

x[n][d++] = Double.parseDouble(str.nextToken());

d++;

}

LineToRead="";

}

t[n]=Double.parseDouble(LineToRead);

x[n][par.d()]=1.0;

}

publicstaticvoid data()throws IOException{

DataInputStream in=null;

try{

in=new DataInputStream(new FileInputStream(par.f()));

for(int n=0;n<par.n();n++){

String LineToRead=in.readLine();

if(LineToRead.length()==0){

System.out.println("Remove empty lines");

}

else{

newLineToRead(LineToRead,n);

}

}

}finally{if(in!=null){in.close();}}

}

publicstaticdouble x(int n,int d){return x[n][d];}

publicstaticdouble

>

[4141 byte] By [nay07a] at [2007-11-26 20:52:48]
# 1

Looks like I didnt copy the last bit...the rest of the code is

public static double x(int n,int d){return x[n][d];}

public static double t(int n){return t[n];}

}

nay07a at 2007-7-10 2:18:31 > top of Java-index,Java Essentials,New To Java...
# 2
Hi,parseDouble can only parse a string that contains one double. Looks like you have several doubles in that string.Kaj
kajbja at 2007-7-10 2:18:31 > top of Java-index,Java Essentials,New To Java...
# 3
Or in simple words, your string contains more than one . (dot)Of course it cannot be parsed to Double
Thunder_Blasta at 2007-7-10 2:18:31 > top of Java-index,Java Essentials,New To Java...
# 4
thanks for the replies.Can you give me a hint on how I can rectify the error?
nay07a at 2007-7-10 2:18:31 > top of Java-index,Java Essentials,New To Java...
# 5
> thanks for the replies.> > Can you give me a hint on how I can rectify the error?Hint - use String.split() to split the existing string into an array of strings and then parse each array item.
sabre150a at 2007-7-10 2:18:31 > top of Java-index,Java Essentials,New To Java...
# 6
Thanks sabre150
nay07a at 2007-7-10 2:18:31 > top of Java-index,Java Essentials,New To Java...