Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ex2binaryfile;
- import java.io.*;
- public class Ex2BinaryFile {
- public static void main(String[] args) throws IOException {
- try (
- // Create an output stream to the file
- // Append new data if file already exists
- FileOutputStream output =
- new FileOutputStream("Ex2BinaryFile.dat", true);
- ) {
- // Output 100 integers created randomly into the file
- for (int i = 0; i < 100; i++)
- output.write((int)(1 + Math.random() * 100));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement