code: private long lastModified(URL url) {
      if (url.getProtocol().equals("file")) {
        return new File(url.getFile()).lastModified();
      } else {
        try {
          URLConnection conn = url.openConnection();
          if (conn instanceof JarURLConnection) {
            URL jarURL = ((JarURLConnection) conn).getJarFileURL();
            if (jarURL.getProtocol().equals("file")) { return new File(jarURL.getFile()).lastModified(); }
          }
        } catch (IOException e1) {
          return -1;
        }
        return -1;
      }
    }
docs: Return url's last modified date time.
  saves some opening and closing