title: why the size of File.length() in java is not same with that of linux du command
body: <p>1> for a empty directory,  linux command du will show 0 size, that means it does not use disk space. right? 
  but File.length() in java will not show zero, instead it show the empty directory used some bytes. </p>
  
  <p>If it is true that everything in Unix is a file and should take up disk space, then Java is right here, why du show its 0 blocks. </p>
  
  <p>If it should be 0 blocks then why Java show up some bytes used by an empty directory?  </p>
  
  <pre><code>$ mkdir empty_directory
  $ du -h empty_directory/
    0B    empty_directory/
  $ du  empty_directory
    0     empty_directory
  
  
  File f = new File("/test/empty_directory");
  if (f.exists() &amp;&amp; f.isDirectory()) {
      System.out.println(f.length());
  }
  
  68
  </code></pre>
  
  <p>2> for a same no empty file, the size show by linux command du is still not same as that of File.length() in java.<br>
  Is the reason only from the difference units: the blocks used by du and the bytes used by File.length()? </p>
  
  <pre><code>$ du -h oneline.txt 
  4.0K    oneline.txt
  $ du   oneline.txt 
  8    oneline.txt
  $ ls -s oneline.txt
  8    oneline.txt
  </code></pre>
  
  <p>-s      Display the number of file system blocks actually used by each file, in units of 512 bytes, where partial units are rounded up to the next integer value.  If the output is to a terminal, a total sum for all the file sizes is output on a line before the listing.  The environment variable BLOCKSIZE overrides the unit size of 512 bytes.</p>
  
  <pre><code>File f = new File("/test/oneline.txt");
  if (f.exists() &amp;&amp; f.isFile()) {
      System.out.println(f.length());
  }
  
  26
  </code></pre>
  
  <p>confused. will you please give some help on this? </p>