package DataStreamTest;
import java.io.*;

public class DataStreamTest {
    public static void main(String[] args) throws IOException {
        try (DataOutputStream out = new DataOutputStream(new FileOutputStream("sample.dat"))) {
            out.writeInt(123);
            out.writeFloat(123.456F);
        }
        try (DataInputStream in = new DataInputStream(new FileInputStream("sample.dat"))) {
            System.out.println(in.readInt());
            System.out.println(in.readFloat());
        }
    }
}
