public class Solution { public static void main(String[] args) { try{FileInputStream stream = new FileInputStream(args[0]); int n1 = 0; int n2 = 0; int a; while (stream.available() > 0) { a =stream.read(); n1 += a; String c = Integer.toString(a); if(c == " ") n2 ++; } stream.close(); double d = (double)Math.round((n2/n1*100)*100d)/100d; System.out.println(d);} catch(IOException e){} } }