Honestly, tried everything, no idea what is wrong here...
Thanks for your help.
package pl.codegym.task.task18.task1817;
/*
Spacje
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class Solution {
public static void main(String[] args) throws IOException {
File file = new File(args[0]);
FileInputStream inputStream = new FileInputStream(file);
int n1 = inputStream.available(); // - all chars
int n2 = 0; // - spaces
while (inputStream.available() > 0) {
if (inputStream.read() == 32) {
n2++;
}
}
double result = (double)n2 / ((double)n1 * 100);
System.out.printf("%.2f", result);
inputStream.close();
}
}