import java.io.*;
public class Main {

    public static void main(String[] args) throws IOException {

        FileInputStream fis = new FileInputStream(args[0]);
        InputStreamReader reader = new InputStreamReader(fis);

        int whitespace = 0;
        int all = 0;
        double s;

        while(reader.ready()){
            char c = (char) reader.read();
            all++;
            if (c == ' '){
                whitespace++;
            }
        }
        s = (double) (whitespace/all)*100;
        System.out.printf("%.2f %n",s);
        fis.close();
    }
}
Помогите пожалуйста