import java.io.*;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) throws IOException {
        String str = "10 1 5 25 ";

        String[] string = str.split(" ");
        int[] numbers = new int[string.length];
        for(int i = 0; i< string.length; i++){
            numbers[i] = Integer.parseInt(string[i]);
        }

        try {
            DataOutputStream out = new DataOutputStream(new FileOutputStream("2.bin"));
            for(int number: numbers){
                out.writeInt(number);
            }
            out.close();
        }
        catch (IOException ex) {
            System.out.println("Error " + ex);
        }

        DataInputStream in = new DataInputStream(new FileInputStream("2.bin"));
        try {
            while (true)
                System.out.println(in.readInt());
        } catch (EOFException ignored) {
            System.out.println("[EOF]");
        }
        in.close();

    }
}
