В чем может быть проблема вообще не вижу смотрю другие вроде так же делали у них все проходит где ошибся?:)
package com.javarush.task.task18.task1817;
/*
Пробелы
*/
import java.io.FileInputStream;
import java.io.IOException;
public class Solution {
public static void main(String[] args) throws IOException {
FileInputStream in = new FileInputStream(args[0]);
int countSpace = 0;
int countChar = 0;
while (in.available() > 0) {
countChar++;
if (in.read() == ' ') {
countSpace++;
}
}
in.close();
float res =(float) countSpace/countChar;
System.out.println(String.format("%.2f", res));
}
}