Here you can find the source of getLength(String htmlUrl)
public static int getLength(String htmlUrl) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.net.URL; import java.net.URLConnection; public class Main { public static int getLength(String htmlUrl) throws IOException { URL url = new URL(htmlUrl); URLConnection con = url.openConnection(); return con.getContentLength(); }/*from w w w .j ava 2s.co m*/ }