Count the number of '8's Problem in Java
<p>Im stuck with the below problem.</p>

<p><strong>Problem Statement:</strong></p>

<p>Given a non-negative int n, return the count of the occurrences of 8 as a digit, except that an 8 with another 8 immediately to its left counts double, so 8818 yields 4.</p>

<p>Note: mod (%) by 10 yields the rightmost digit (126 % 10 is 6), while divide (/) by 10 removes the rightmost digit (126 / 10 is 12). </p>

<p><strong>The above problem has to be solved without using Recursion and without the usage of any formulas.</strong></p>

<p>The function signature is <code>public int count8(int n)</code></p>

<p>Examples are:</p>

<pre><code>count8(8) → 1     
count8(818) → 2     
count8(8818) → 4
</code></pre>

<p>I got this problem from one of the Programming Forums. I dont know how to start with this problem, I want to solve it, but I am really confused on where to begin.</p>
