### Question:
ZipUtility { public static boolean createZipFromFiles(final List<File> files, final String filename) { return createZipFromFiles(files.toArray(FILE_0_LENGTH), filename); } private  ZipUtility(); static boolean createZipFromDirectory(final String directory,
                                               final String filename,
                                               final boolean absolute); static boolean createZipFromFiles(final List<File> files,
                                           final String filename); static boolean createZipFromFiles(final File[] files,
                                           final String filename); static List<String> unZip(final File tarFile, final File directory); static void main(final String[] args);  }### Answer:
@Test public void createZipFromFiles() throws IOException { final File dir = new File("/tmp/tests/dir"); FileUtils.createDir(dir); final File test = new File(dir, "test"); test.createNewFile(); final File test2 = new File(dir, "test2"); test2.createNewFile(); File[] arrayFile = dir.listFiles(); final List<File> listFile = new ArrayList<File>(); Collections.addAll(listFile, arrayFile); final File zip = new File(dir.getParentFile(), "testzip.zip"); assertTrue(ZipUtility.createZipFromFiles(listFile, zip.getAbsolutePath())); FileUtils.forceDeleteRecursiveDir(dir); List<String> list = ZipUtility.unZip(zip, dir); assertEquals(2, list.size()); arrayFile = FileUtils.getFiles(dir); assertEquals(2, arrayFile.length); int cpt = 0; for (final File file : arrayFile) { for (final String name : list) { if (name.equals(file.getName())) { cpt++; break; } } } assertEquals(2, cpt); FileUtils.delete(zip); assertTrue(ZipUtility.createZipFromFiles(arrayFile, zip.getAbsolutePath())); FileUtils.forceDeleteRecursiveDir(dir); list = ZipUtility.unZip(zip, dir); assertEquals(2, list.size()); final File[] arrayFiles2 = arrayFile = FileUtils.getFiles(dir); assertEquals(2, arrayFiles2.length); cpt = 0; for (final File file : arrayFile) { for (final File file2 : arrayFiles2) { if (file2.getName().equals(file.getName())) { cpt++; break; } } } assertEquals(2, cpt); FileUtils.forceDeleteRecursiveDir(dir); FileUtils.deleteDir(dir); FileUtils.delete(zip); }