Here you can find the source of getLastModifiedHeader(URL url)
public static long getLastModifiedHeader(URL url) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; public class Main { public static long getLastModifiedHeader(URL url) throws IOException { URLConnection conn = url.openConnection(); try {/* w w w .j av a2 s . c om*/ if (conn instanceof HttpURLConnection) { ((HttpURLConnection) conn).setRequestMethod("HEAD"); } return conn.getLastModified(); } finally { if (conn instanceof HttpURLConnection) { ((HttpURLConnection) conn).disconnect(); } } } }