Here you can find the source of saveFile(byte[] data, String fileName)
public static void saveFile(byte[] data, String fileName) throws RuntimeException
//package com.java2s; import java.io.File; import java.io.FileOutputStream; public class Main { private static final File DESTINY_DIR = new File( "/sdcard/unlocksecurity/"); public static void saveFile(byte[] data, String fileName) throws RuntimeException { if (!DESTINY_DIR.exists() && !DESTINY_DIR.mkdirs()) { return; }/*from ww w. j a va 2 s . com*/ File mainPicture = new File(DESTINY_DIR, fileName); try { FileOutputStream fos = new FileOutputStream(mainPicture); fos.write(data); fos.close(); } catch (Exception e) { throw new RuntimeException("Image could not be saved.", e); } } }