code: public static void repack(File zip, int compressionLevel) {
      try {
        File tmpZip = FileUtils.getTempFileFor(zip);
  
        repack(zip, tmpZip, compressionLevel);
  
        // Delete original zip
        if (!zip.delete()) {
          throw new IOException("Unable to delete the file: " + zip);
        }
  
        // Rename the archive
        FileUtils.moveFile(tmpZip, zip);
      }
      catch (IOException e) {
        throw ZipExceptionUtil.rethrow(e);
      }
    }
docs: Repacks a provided ZIP file and replaces old file with the new one.
  <p>
  
  @param zip
  source ZIP file to be repacked and replaced.
  @param compressionLevel
  compression level.