counting the number of zeros
<p>I'm trying to write a program that gets a .txt file that only has something like 10000010000010000010001</p>

<p>I'm trying to count the number of zeros and output it like  5 5 5 3. I thought if I convert a string into a <code>double</code> or <code>int</code> I could write an <code>if</code> or <code>for</code> loop. </p>

<pre><code>import java.util.Scanner;

public class test1{

    public static void main(String[] args) {

        java.io.File test2 = new java.io.File("test3.txt");

        try
        {
           Scanner input = new Scanner(test2);

        while(input.hasNext())
        {
            String num = input.nextLine();
            System.out.println(num);

            double n = Double.parseDouble(num);
            System.out.println(n);
        } 
        }

        catch (Exception e){
            System.out.println("could not find file");
        }   

       }

}
</code></pre>
