public static File writeDataToFile(final byte[] data,final File file,final boolean append){
  try (FileOutputStream out=new FileOutputStream(file,append)){
    out.write(data);
    out.close();
    return file;
  }
 catch (  Exception e) {
    JKExceptionUtil.handle(e);
    return null;
  }
}

public static File writeDataToFile ( final byte [ ] data , final File file , final boolean append ) { try ( FileOutputStream out = new FileOutputStream ( file , append ) ) { out . write ( data ) ; out . close ( ) ; return file ; } catch ( Exception e ) { JKExceptionUtil . handle ( e ) ; return null ; } }
write data to file .
