title: How to get file size in Java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2149785/size-of-folder-or-file">Size of folder or file</a>  </p>
  </blockquote>
  
  
  
  <p>I used this code to instantiate a <code>File</code> object:</p>
  
  <pre><code>File f = new File(path);
  </code></pre>
  
  <p>How do I get the size of this file?</p>
  
  <p>What is the difference between <code>getUsableSpace()</code>, <code>getTotalSpace()</code>, and <code>getFreeSpace()</code>?</p>