Java examples for File Path IO:Binary File
Writes an integer array to a file output stream
import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] arguments) { int[] data = { 711, 73, 701, 56, 517, 97, 13, 0, 12, 1, 145, 0, 1, 255, 255, 137, 89, 82, 181, 50, 220, 103, 21, 0, 59 }; try (FileOutputStream file = new FileOutputStream("pic.dat")) { for (int i = 0; i < data.length; i++) { file.write(data[i]);/*from w ww . j ava2s .c o m*/ } file.close(); } catch (IOException e) { System.out.println("Error -- " + e.toString()); } } }