I have written a split function whose constructor takes a String Object
(For Example: 21.316621 87.01393 9830.686907)
.Then it splits it into three parts using split() function. Then converts these three new String Object into three primitive type double. I want to perform some arithmetic operation on these double values but it is showing Exception as following--
Exception in thread "main" java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
Split function is as following--
public class Split {
public Split(String str){
Double[] lla = new Double[3];
String[] parts=str.split("\t");
lla[0] = Double.parseDouble(parts[0]);
lla[1] = Double.parseDouble(parts[1]);
lla[2]= Double.parseDouble(parts[2]);
lla[0]+=123.567;
lla[1]+=12.456;
lla[2]+=76.5678;
System.out.println(lla[0]);
System.out.println(lla[1]);
System.out.println(lla[2]);
System.out.println();
}
}
Please help me out of this problem.Thanks