Write data with FileOutputStream
import java.io.FileOutputStream; class FileOutputStreamDemo { public static void main(String args[]) throws Exception { FileOutputStream fos = new FileOutputStream(args[0]); // Write 12 bytes to the file for (int i = 0; i < 12; i++) { fos.write(i); } // Close file output stream fos.close(); } }