public class Solution { public static int p; public static int s; public static float result; public static void main(String[] args) throws IOException { FileInputStream fis = new FileInputStream(args[0]); ArrayList<Character> list = new ArrayList<Character>(); while(fis.available() > 0) list.add((char)fis.read()); fis.close(); s = list.size(); for(int i = 0; i < list.size(); i++) if((int)list.get(i) == Integer.valueOf(' ')) p++; result = (float)p / s * 100; System.out.println(Math.round(result * 100) / 100.0f);