Advertisement
mbojmaliev

Java I/O Оперативни Системи Задача1

Mar 4th, 2018
548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.io.File;
  2.  
  3. public class HW01_1 {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         File f = new File(args[0]);
  8.         int vkupno = 0;
  9.         float prosek = 0;
  10.         try{
  11.  
  12.             for(File file : f.listFiles()){
  13.                 if(file.isFile()){
  14.                     if(file.getName().contains(".txt")){
  15.                         vkupno++;
  16.                         prosek+=file.length();
  17.                     }
  18.                 }
  19.             }
  20.  
  21.         }finally {
  22.             System.out.println(prosek/vkupno);
  23.         }
  24.  
  25.  
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement