Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.BufferedOutputStream;

import java.io.DataOutputStream;

import java.io.FileOutputStream;

public class Main {
    public static void writeBin(String fileName, byte[] data) {
        try {
            DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fileName)));
            for (byte b : data) {
                out.writeByte(b);
            }
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}