Is there a maximum value or output to BigIntegers?
I have a simple loop that does n = n ^ 2, where n is a BigInteger. But,
after the 11th iteration of the loop (I currently have it set to not go
further because of this issue), the console goes blank, but filled with
spaces. Like there should be characters there but there aren't. This is
evident as it's highlight-able. My question is; is there a cap on
BigIntegers, a max displayable output, or am I just not giving my CPU
enough time do the calculation?
import java.math.*;
public class Main {
static BigInteger n = BigInteger.valueOf(123);
static int j = 11;
public static void main(String[] args) {
while(j != 0) {
System.out.println(n);
n = n.pow(2);
j--;
}
System.out.println("Done. ");
}
}
No comments:
Post a Comment