public static void writeByteArrayToFile(File file,byte[] data,boolean append) throws IOException {
  OutputStream out=null;
  try {
    out=openOutputStream(file,append);
    out.write(data);
    out.close();
  }
  finally {
    IOUtils.closeQuietly(out);
  }
}

public static void writeByteArrayToFile ( File file , byte [ ] data , boolean append ) throws IOException { OutputStream out = null ; try { out = openOutputStream ( file , append ) ; out . write ( data ) ; out . close ( ) ; } finally { IOUtils . closeQuietly ( out ) ; } }
writes a byte array to a file creating the file if it does not exist .
