Use FileOutputStream to write the bytes to a file. : FileOutputStream « File Input Output « Java

Use FileOutputStream to write the bytes to a file.



public class Main {
  public static void main(String[] argv) throws Exception {
    byte[] vals = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74 };
    FileOutputStream fout = new FileOutputStream("Test.dat");
    for (int i = 0; i < vals.length; i += 2)


Related examples in the same category

1.File IO
2.Copy Bytes between FileInputStream and FileOutputStream
3.Copy byte between FileInputStream and FileOutputStream
4.Write byte array to a file using FileOutputStream
5.Create DataOutputStream from FileOutputStream
6.Write double to a file using DataOutputStream
7.Append output to file using FileOutputStream
8.Create FileOutputStream object from File object
9.Create FileOutputStream object from String file path
10.Write file using FileOutputStream
11.Write UTF String, integer and double with DataOutputStream
12.Write data with FileOutputStream
13.Split file
14.Rollover FileOutputStream