Here you can find the source of zip(File[] _files, File _zipFile)
public static boolean zip(File[] _files, File _zipFile)
//package com.java2s; //License from project: Open Source License import android.util.Log; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class Main { private static final int BUFFER = 2048; public static boolean zip(File[] _files, File _zipFile) { try {/*w w w. jav a 2 s .c om*/ BufferedInputStream origin = null; FileOutputStream dest = new FileOutputStream(_zipFile); ZipOutputStream out = new ZipOutputStream( new BufferedOutputStream(dest)); byte data[] = new byte[BUFFER]; for (int i = 0; i < _files.length; i++) { Log.d("Compress", "Adding: " + _files[i]); FileInputStream fi = new FileInputStream(_files[i]); origin = new BufferedInputStream(fi, BUFFER); ZipEntry entry = new ZipEntry(_files[i].getName()); out.putNextEntry(entry); int count; while ((count = origin.read(data, 0, BUFFER)) != -1) { out.write(data, 0, count); } origin.close(); } out.close(); return true; } catch (Exception e) { e.printStackTrace(); return false; } } }