public long getFileSize(String URL) {
		int fileLength = -1;
		try {
			URL url = new URL(URL);
			HttpURLConnection httpConnection = (HttpURLConnection) (url
					.openConnection());
			int responseCode = httpConnection.getResponseCode();
			if (responseCode >= 400) {
				System.out.println("Web server doesnot response");
				return -2;// Webserver donot response
			}
			String sHeader;
			for (int i = 1;; i++)// get file length
			{
				sHeader = httpConnection.getHeaderFieldKey(i);
				if (sHeader != null) {
					if (sHeader.equals("Content-Length")) {
						//int length = httpConnection.getContentLength();
						//textArea.append("\nFile length:---" + length);
						fileLength = Integer.parseInt(httpConnection
								.getHeaderField(sHeader));
						textArea.append("\nFile length:" + fileLength);
						break;
					}
				} else {
					break;
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return fileLength;

	}