Java tutorial
import java.io.IOException; import java.util.Date; import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipEntry; public class MainClass { public static void main(String[] args) throws IOException { JarFile jf = new JarFile(args[0]); Enumeration e = jf.entries(); while (e.hasMoreElements()) { JarEntry je = (JarEntry) e.nextElement(); String name = je.getName(); Date lastModified = new Date(je.getTime()); long uncompressedSize = je.getSize(); long compressedSize = je.getCompressedSize(); int method = je.getMethod(); if (method == ZipEntry.STORED) { System.out.println(name + " was stored at " + lastModified); System.out.println("with a size of " + uncompressedSize + " bytes"); } else if (method == ZipEntry.DEFLATED) { System.out.println(name + " was deflated at " + lastModified); System.out.println("from " + uncompressedSize + " bytes to " + compressedSize + " bytes, a savings of " + (100.0 - 100.0 * compressedSize / uncompressedSize) + "%"); } else { System.out.println(name + " was compressed using an unrecognized method at " + lastModified); System.out.println("from " + uncompressedSize + " bytes to " + compressedSize + " bytes, a savings of " + (100.0 - 100.0 * compressedSize / uncompressedSize) + "%"); } } } }