Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class Main {
- static long max_length = 0;
- static File max_file = null;
- static void rec(File at) {
- File[] files = at.listFiles();
- for(int i = 0; i < files.length; i++) {
- if(files[i].isDirectory()) {
- rec(files[i]);
- }
- else {
- if(max_length < files[i].length()) {
- max_length = files[i].length();
- max_file = files[i];
- }
- }
- }
- }
- public static void main(String[] args) {
- String filePath = "/Users/josiftepegjozov/Documents/test";
- File S = new File(filePath);
- rec(S);
- System.out.println(max_file.toString());
- }
- }
- // rec(folder: test)
- // rec(folder: test2)
- // rec(folder: test3)
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement