Advertisement
Josif_tepe

Untitled

Mar 25th, 2021
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. import javax.annotation.processing.SupportedSourceVersion;
  2. import java.io.*;
  3. import java.util.logging.Filter;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         String filePath = "pat do datoteka";
  9.         File file = new File(filePath);
  10.  
  11.         File[] files = file.listFiles();
  12.         long max_length = 0;
  13.         File tmp = null;
  14.         for(int i = 0; i < files.length; i++) {
  15.             if(max_length < files[i].length()) {
  16.                 max_length = files[i].length();
  17.                 tmp = files[i];
  18.             }
  19.         }
  20.         System.out.println(tmp.getName());
  21.  
  22.  
  23.     }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement