private byte[] zipFiles(File directory,String[] files) throws IOException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ZipOutputStream zos=new ZipOutputStream(baos);
  addFolderToZip("",directory.getPath(),zos);
  zos.flush();
  baos.flush();
  zos.close();
  baos.close();
  return baos.toByteArray();
}

private byte [ ] zipFiles ( File directory , String [ ] files ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ZipOutputStream zos = new ZipOutputStream ( baos ) ; addFolderToZip ( "" , directory . getPath ( ) , zos ) ; zos . flush ( ) ; baos . flush ( ) ; zos . close ( ) ; baos . close ( ) ; return baos . toByteArray ( ) ; }
compress the given directory with all its files .
