code: public static void pack(final File sourceDir, final File targetZipFile, final boolean preserveRoot) {
      if (preserveRoot) {
        final String parentName = sourceDir.getName();
        pack(sourceDir, targetZipFile, new NameMapper() {
          public String map(String name) {
            return parentName + PATH_SEPARATOR + name;
          }
        });
      }
      else {
        pack(sourceDir, targetZipFile);
      }
    }
docs: Compresses the given directory and all its sub-directories into a ZIP file.
  <p>
  The ZIP file must not be a directory and its parent directory must exist.
  Will not include the root directory name in the archive.
  
  @param sourceDir
  root directory.
  @param targetZipFile
  ZIP file that will be created or overwritten.
  @param preserveRoot
  true if the resulted archive should have the top directory entry