title: A quicker method for finding out the number of digits in a number and print it?
body: <p>I have a question given by my computer teacher to find out the number of two digit number and three digit number and terminate the program (when user enter 0 )and print the total two digit ,three digit numbers and other digit number.</p>
  
  <p>This is an example output in terminal window:</p>
  
  <pre><code>Enter your number: 23
  Enter your number: 1
  Enter your number: 412
  Enter your number: -123
  Enter your number: 32332
  Enter your number: 12
  Enter your number: -1
  Enter your number: 0
  Two digit numbers : 2
  Three digit numbers : 2
  Other digit numbers : 3
  </code></pre>
  
  <p>This is my program : </p>
  
  <pre><code>import java.io.*;
  public class two_three_digits
  {
      static DataInputStream dis = new DataInputStream(System.in);
      static void main()throws IOException
      {
          int two = 0 , three = 0 , oth = 0;
          while(true)
          {
              System.out.print("Enter your number: ");
              int n = Integer.parseInt(dis.readLine());
              n = (int)Math.abs(n);
              int d = 0,cn = n;
              if(n == 0)break;
              else if(n &gt; 9 &amp;&amp; n &lt; 100)two++;
              else if(n &gt; 99 &amp;&amp; n &lt;1000)three++;
              else oth++;
          }
          System.out.println("Two digit numbers : "+two);
          System.out.println("Three digit numbers : "+three);
          System.out.println("Other digit numbers : "+oth);
      }
  }
  </code></pre>
  
  <p>I wished to know if there was any shorter way to do the same task ? Like using <code>arrays</code> , <code>string</code> or <code>Bitswise operator</code> , etc. 
  Also I would rather like if you would tell the method of how to do it instead of simply the program as I am a learning student and wish to solve it out myself.</p>
  
  <p>Edit: Sorry because i forgot to term one thing - by the word quicker i actually meant for speed (and more or less , size of program too)</p>