Get the file size

ReturnMethodSummary
longlength()Returns the length of the file denoted by this abstract pathname.

import java.io.File;

public class Main {

  public static void main(String[] args) {
    File aFile = new File("c:/a.htm");
    System.out.println(aFile.length());

  }
}

The output:


13020
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.