title: Compare Last Modified Java
body: <p>I have two files, a local file and a file from an URL.</p>
  
  <p>I wanna compare if the last modified from local file is older than the URL file.</p>
  
  <pre><code>File oldFile = new File("local file");
  URL newFile = new URL("url file");
  HttpURLConnection httpCon = (HttpURLConnection) newFile.openConnection();
  
  if(oldFile.lastModified() &lt; httpCon.getLastModified()){
     //do something
  }
  </code></pre>
  
  <p>Can you help me? Thanks</p>