import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.RandomAccessFile; public class MainClass { public static void main(String[] argv) { try { RandomAccessFile raf = new RandomAccessFile("datafile", "rw"); BufferedOutputStream bos = new BufferedOutputStream(raf); DataOutputStream dos = new DataOutputStream(bos); dos.writeDouble(Math.PI); dos.close(); bos.close(); raf.close(); } catch (IOException e) { } } }