Code example for BigInteger

Methods: add

0
import java.math.BigInteger; 
 
public class euler20 
{ 
	static BigInteger ONE = BigInteger.ONE;
	static BigInteger TWO = ONE.add(ONE);
	 
	public static void main(String[] args)
	{ 
		//first find 100! 
		BigInteger fact = new BigInteger("100");
		BigInteger i = new BigInteger("99");
		for(; i.compareTo(TWO) >= 0; i=i.subtract(ONE))
		{ 
			fact = fact.multiply(i);
		} 
		 
		//convert it to a string 
		String str = fact.toString();
		 
		//then get the individual digits