Here you can find the source of zipFiles(List
public static void zipFiles(List<File> srcfile, File zipfile)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class Main { public static void zipFiles(List<File> srcfile, File zipfile) { byte[] buf = new byte[4096]; try {/*from w ww . jav a 2s .c om*/ ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipfile)); for (File file : srcfile) { FileInputStream in = new FileInputStream(file); out.putNextEntry(new ZipEntry(file.getName())); int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } out.closeEntry(); in.close(); } out.close(); } catch (Exception e) { e.printStackTrace(); } } }