Save the bytes to a file in Java
Description
The following code shows how to save the bytes to a file.
Example
/*w ww . j av a 2 s. c o m*/
import java.io.FileOutputStream;
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)
fout.write(vals[i]);
fout.close();
}
}