Java tutorial
//package com.java2s; import android.text.TextUtils; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { private static void saveToFile(byte[] data, String path) { if (data == null || data.length == 0) { return; } if (TextUtils.isEmpty(path)) { return; } FileOutputStream fos = null; try { fos = new FileOutputStream(path, true); fos.write(data); fos.flush(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } } }