title: Improve code that factorizes in a faster way?
body: <p>I would like to make this piece of code faster. It returns all the factors (prime numbers) of a long number. It obviously takes minutes to be executed if the <code>longNumber</code> is a particular one.</p>
  
  <pre><code>int div = 2;
  String factors = "";
  
  while (longNumer != 1)
  {
      if (longNumer % div == 0)
      {
          longNumer /= div;
          factors += div + " ";
      }
      else { div++; }
  }
  
  //longNumber = 10, gives: 2 5. 
  //longNumber = 150, gives: 3 5 7.
  //longNumber = 10523, gives: 17 619.
  </code></pre>
  
  <p>It takes too long with numbers such "7544222046562688368", and it's not good, what would you suggest?</p>