3.Посчитай отношение пробелов ко всем символам в файле и выведи в консоль это число.
4. Выведенное значение необходимо округлить до 2 знаков после запятой.
package com.javarush.task.task18.task1817;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.DecimalFormat;
public class Solution {
public static void main(String[] args) throws IOException {
String pattern = "##0.00";
DecimalFormat decimalFormat = new DecimalFormat(pattern);
FileInputStream fileInputStream = new FileInputStream(args[0]);
System.out.println(args[0]);
byte [] b = new byte[fileInputStream.available()];
fileInputStream.read(b);
System.out.println(b);
fileInputStream.close();
int space = 0;
for (int i = 0; i < b.length; i++) {
if(b[i]==32)space++;
}
System.out.println(decimalFormat.format((double)b.length/(space*100)));
}
}