title: Counting integer digits
body: <p>I'm trying to count the digits of an integer with java, it supposed to give 4 but instead I get 1 .
  I don't know if I did something wrong, if someone could help.
  Here's the code :</p>
  <pre><code>public static void main(String[] args) {
          int n = 4781, i = 0;
          while (n != 0) {
              n %= 10;
              n /= 10;
              i++;
          }
          System.out.println(i);
      }
  </code></pre>