title: Count number of zeroes in number issue with code
body: <p>My code is counting the wrong number of zeroes in a read in text file and I'm not sure how to fix it. Random numbers are coming up either one more than what i need or not reading at all.  Can anyone help?</p>
  
  <pre><code>private static int count0(int n, boolean zero) {
    if (n &lt;= 0)
      return 0;
    else if (n % 10 == 0)
      return 1 + (zero ? 1 : 0) + count0(n / 10, true);
    else
      return count0(n / 10, false);
  }
  
  public static int count0(int n) {
    return count0(n, false);
  }
  
  enter code here
  </code></pre>