Не вижу ошибки
package com.javarush.task.task18.task1817;
/*
Пробелы
*/
import java.io.FileInputStream;
import java.io.IOException;
public class Solution {
public static void main(String[] args) {
double spacesCount, count, diff;
spacesCount = count = 0.0;
try (FileInputStream fis = new FileInputStream(args[0])) {
int readed;
do {
readed = fis.read();
if (readed == ' ') spacesCount++;
count++;
} while (readed != -1);
} catch (IOException e) {
e.printStackTrace();
}
diff = spacesCount * 100 / count;
System.out.printf("%.2f", diff);
}
}