Что не так ?
package com.javarush.task.task18.task1817;
/*
Пробелы
*/
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Locale;
public class Solution {
public static void main(String[] args) throws IOException {
//args = new String[10];
//args [0] = "C:\\test\\test.txt";
FileReader fileReader = new FileReader(args[0]);
int space = 0 ;
int symbol = 0;
while (fileReader.ready()){
char ch = (char) fileReader.read();
symbol++;
if(ch == ' ')
space++;
}
fileReader.close();
if(symbol == 0){
System.out.println("100,00");
}
else {
String r = String.format("%.2f",(int) (((float) space / symbol * 100) * 100) / 100d).replace('.', ',');
System.out.println(r);
}
}
}