title: Limitation in Java HttpUrlConnection getting content length
body: <p>Right so, I started my project on creating a Java download manager which is going nicely. The only problem I am seeing at the moment is when i request the content length of the URL. When i use the method provided by HttpUrlConnection's getContentLength, it returns an Int. </p>
  
  <p>This is great if i was only to ever download files that were less than 2GB in file size. Doing some more digging and find that java does not support unsigned int values, but even so that would only give me a file size of a 4GB max. </p>
  
  <p>Can anyone help me in the right direction of getting the content size of a file that is greater than 2GB.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks for you answer Elite Gentleman, i tried what you suggested but that kept returning a null value, so instead what i did was</p>
  
  <pre><code>HttpURLConnection conn = (HttpURLConnection) absoluteUrl.openConnection();
  conn.connect();
  long contentLength = Long.parseLong(conn.getHeaderField("Content-Length"));
  </code></pre>
  
  <p>For some reason just using conn.getRequestProperty always returned a null for me</p>