private static long writeFile(String path,byte[] data){
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(path);
    out.write(data);
    return data.length;
  }
 catch (  Exception e) {
    Log.e(TAG,"Failed to write data",e);
  }
 finally {
    try {
      out.close();
    }
 catch (    Exception e) {
      Log.e(TAG,"Failed to close file after write",e);
    }
  }
  return -1;
}

private static long writeFile ( String path , byte [ ] data ) { FileOutputStream out = null ; try { out = new FileOutputStream ( path ) ; out . write ( data ) ; return data . length ; } catch ( Exception e ) { Log . e ( TAG , "Failed to write data" , e ) ; } finally { try { out . close ( ) ; } catch ( Exception e ) { Log . e ( TAG , "Failed to close file after write" , e ) ; } } return - 1 ; }
writes the data to a file .
