title: Android store file size in long variable
body: <p>I am getting the file size in my android app which is on a remote machine by the following line:</p>
  
  <pre><code>long fileLengthOnServer = connection.getContentLength();
  </code></pre>
  
  <p>The problem is sometimes the value of fileLengthOnServer is a negative value. As I read in some posts a long variable should be initialized by a value with L at the end, but I dont know in my case how to add it. If I cast it to long solves the problem?</p>
  
  <p>Thanks in advance</p>