Java File Size Get getFileSize(String filename)

Here you can find the source of getFileSize(String filename)

Description

get File Size

License

Open Source License

Declaration

public static int getFileSize(String filename) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {

    public static int getFileSize(String filename) {
        try {/*from  w  ww.j  av  a 2 s  .c om*/
            File fl = new File(filename);
            int length = (int) fl.length();
            return length;
        } catch (Exception e) {
            return 0;
        }
    }
}

Related

  1. getFileSize(int fileSize)
  2. getFileSize(long fileSize)
  3. getFilesize(String address)
  4. getFileSize(String fileName)
  5. getFileSize(String filename)
  6. getFileSize(String fileName, Logger log)
  7. getFileSize(String filename, String dir)
  8. getFileSize(String filePath)
  9. getFileSize(String filePath)