Java File Size Get getFileSize(File[] files)

Here you can find the source of getFileSize(File[] files)

Description

Calculate the size of files

License

Open Source License

Parameter

Parameter Description
files a parameter

Declaration

public static long getFileSize(File[] files) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {
    /**/*from   w  w w  .j av  a  2s.com*/
     * Calculate the size of files
     * 
     * @param files
     * @return
     */
    public static long getFileSize(File[] files) {
        long num = 0L;

        for (File file : files) {
            if (file.isDirectory()) {
                num += getFileSize(file.listFiles());
            } else {
                num += file.length();
            }
        }

        return num;
    }
}

Related

  1. getFileSize(File file)
  2. getFileSize(File file)
  3. getFileSize(File file)
  4. getFileSize(File file)
  5. getFileSize(File file)
  6. getFileSize(final String filename)
  7. getFileSize(final String filePath)
  8. getFileSize(final String path)
  9. getFileSize(InputStream inputStream)