Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;

public class Main {
    private static long calculateDirectorySize(File directory) {
        long result = 0;
        for (File file : directory.listFiles()) {
            if (file.isDirectory()) {
                result += calculateDirectorySize(file);
            } else {
                result += file.length();
            }
        }
        return result;
    }
}