I'm making a project concerned big numbers without BigInteger, BigDecimal etc. I've managed to do all the basics but now I need to add ability to count factorials. My BigNumber stores data as int[] .
Here's a sample solution with BigInteger but I can't use it without having the actual value of my number.
BigInteger n = BigInteger.ONE;
for (int i=1; i<=20; i++) {
n = n.multiply(BigInteger.valueOf(i));
System.out.println(i + "! = " + n);
}
So how to count the value ? Add ints from last to first, multiplying tens by 10, hundreds by 100 and so on and so on and store it as long ?
Source of BigInteger : http://developer.classpath.org/doc/java/math/BigInteger-source.html