Here you can find the source of byte2file(byte[] data, String path)
public static void byte2file(byte[] data, String path)
//package com.java2s; import java.io.File; import java.io.FileOutputStream; public class Main { public static void byte2file(byte[] data, String path) { if (null == data) return; if (data.length < 3 || path.equals("")) return; try {//from ww w .j av a 2 s .com FileOutputStream imageOutput = new FileOutputStream(new File( path)); imageOutput.write(data, 0, data.length); imageOutput.close(); System.out.println("Make Picture success,Please find image in " + path); } catch (Exception ex) { System.out.println("Exception: " + ex); ex.printStackTrace(); } } static public boolean equals(byte[] a1, byte[] a2) { if ((a1 == null) || (a2 == null)) { return a1 == a2; } int nLength = a1.length; if (nLength != a2.length) { return false; } for (int i = 0; i < nLength; i++) { if (a1[i] != a2[i]) { return false; } } return true; } static public boolean equals(int[] a1, int[] a2) { if ((a1 == null) || (a2 == null)) { return a1 == a2; } int nLength = a1.length; if (nLength != a2.length) { return false; } for (int i = 0; i < nLength; i++) { if (a1[i] != a2[i]) { return false; } } return true; } }