title: Java: Simple recursion function returns only 1
body: <p>This is oddly my first Java application, I was wanting to implement an arbitrary precision factorial function, I did the recursive one fine but my iterative one simply outputs "1" and nothing else.. It is so late for me I can not spot why, I am not sure where I went wrong, is there something obvious here?</p>
  
  <pre><code>public static BigInteger ifact(BigInteger n) {
      BigInteger ret = new BigInteger("1");
      BigInteger i = new BigInteger("1");
      for(i = new BigInteger("0"); i.compareTo(n) == 0; i.add(new BigInteger("1"))){
          ret.multiply(i);
      }
      return ret;
  }
  </code></pre>
  
  <p>In case you did not notice it uses the BigInteger package, hense the odd writings.. </p>
  
  <p>Also, like C, can you do something similar to typedef so I don't need to type "BigInteger" each time?</p>
  
  <p><strong>EDIT</strong>: I think I meant to set <code>ret</code> as <code>n</code>, that may be it, or..maybe not.</p>