title: How to multiply each digit in a number efficiently
body: <p>I want to multiply every digit in a number to each other.</p>
  
  <p>For example</p>
  
  <pre><code>515 would become 25(i.e 5*1*5)
  10 would become 0(i.e 1*0)
  111111 would become 1(i.e 1*1*1*1*1*1)
  </code></pre>
  
  <p>I used this code to do it</p>
  
  <pre><code>public static int evalulate(int no)
  {
      if(no==0)return 0;
      int temp=1;
  
      do
      {
          temp=(no%10)*temp;
          no=no/10;
      }while(no&gt;0);
  
      return temp;
  }
  </code></pre>
  
  <p>problem is I want to evaluate for about a <strong>billion</strong> numbers like this</p>
  
  <pre><code>for(int i=0;i&lt;1000000000;i++)evaluate(i);
  </code></pre>
  
  <p>This takes about <strong>146</strong> seconds on my processor.I want to evaluate it within <strong>some</strong> seconds.</p>
  
  <p>So,is it possible to optimize this code using some <code>shift</code>,<code>and</code>,<code>or</code> operators so that I can reduce the time to evaluate <strong>without using multiple threads or parallelizing it</strong></p>
  
  <p>Thanks</p>