Read double from a File in Java
Description
The following code shows how to read double from a File.
Example
//from www . jav a 2 s . co m
import java.io.DataInputStream;
import java.io.FileInputStream;
public class Main {
public static void main(String[] args) throws Exception{
FileInputStream fin = new FileInputStream("myFile.dat");
DataInputStream din = new DataInputStream(fin);
while (true) {
double theNumber = din.readDouble();
System.out.println(theNumber);
}
}
}