Advertisement
fensa08

#OS LAB1/1

Mar 23rd, 2019
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. #OS LAB1/1 made by Fensa08
  2.  
  3. import java.io.*;
  4.  
  5. public class HW01_1 {
  6.     public static void main(String[] args) throws IOException {
  7.  
  8.        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  9.        System.out.println("Vnesi lokacija");
  10.        String path = in.readLine();
  11.        File f = new File(path);
  12.        File []lista = f.listFiles(new FilenameFilter() {
  13.            @Override
  14.            public boolean accept(File dir, String name) {
  15.                return name.endsWith(".txt");
  16.            }
  17.        });
  18.        float prosek = 0;
  19.        for(File file: lista){
  20.            prosek += file.length();
  21.        }
  22.  
  23.         prosek = prosek / lista.length;
  24.        System.out.println("Prosecna golemina na fajlovi so .txt ekstenzija e: " + prosek + "  bytes");
  25.  
  26.  
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement