import java.io.DataInputStream; import java.io.EOFException; import java.io.FileInputStream; import java.io.IOException; public class MainClass { public static void main(String[] args) { try { FileInputStream fin = new FileInputStream("myFile.dat"); DataInputStream din = new DataInputStream(fin); while (true) { double theNumber = din.readDouble(); System.out.println(theNumber); } } catch (EOFException e) { } catch (IOException e) { // abnormal termination System.err.println(e); } } }