public static void save(File file,byte[] bytes) throws IOException {
  OutputStream os=new FileOutputStream(file);
  try {
    os=new BufferedOutputStream(os);
    for (int i=0; i < bytes.length; i+=2048) {
      int len=Math.min(bytes.length - i,2048);
      os.write(bytes,i,len);
    }
  }
  finally {
    os.close();
  }
}

public static void save ( File file , byte [ ] bytes ) throws IOException { OutputStream os = new FileOutputStream ( file ) ; try { os = new BufferedOutputStream ( os ) ; for ( int i = 0 ; i < bytes . length ; i += 2048 ) { int len = Math . min ( bytes . length - i , 2048 ) ; os . write ( bytes , i , len ) ; } } finally { os . close ( ) ; } }
saves a byte array to a file .
