I am reading a following CSV file in java and
1191196800.681 - !AIVDM,1,1,,,13aG?N0rh20E6sjN1J=9d4<00000,0*1D
Here is my code to read this CSV file and convert the 1st column of the CSV file (which is a String) to a double
public class ReadCSV {
public static void main(String[] args) {
try {
BufferedReader CSVFile = new BufferedReader(new FileReader(
"C:\\example.txt"));
try {
String dataRow = CSVFile.readLine();
while (dataRow != null) {
String[] dataarray = dataRow.split("-");
String temp = dataarray[0];
double i = Double.parseDouble(temp);
System.out.println(temp);
System.out.println(i);
dataRow = CSVFile.readLine();
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
When I execute the code I get the following values
1191196800.681
1.191196800681E9
Why is the value of variable "temp" and "i" not the same. What changes must I do in the code to get the following values:
1191196800.681
1191196800.681
Thanks in advance.
1.191196800681E9 == 1191196800.681