Kevin Bhuva
Kevin Bhuva

Reputation: 73

How to use BigInteger value to initialize String Array?

I am writing a program and stuck with below issue of BigInteger.

BigInteger noOfCombinationForWordsToBeSearchedBig = factorial(noOfWordsToBeSearched);
String[][] combinationForWordsToBeSearched = new String[ noOfCombinationForWordsToBeSearchedBig.longValue()][noOfWordsToBeSearched];

I want to initialize the String[][] array with value of noOfCombinationForWordsToBeSearchedBig .

For examaple, i am finding factorial of 17 which is big integer.

Please advise.

Upvotes: 0

Views: 622

Answers (1)

Sazzadur Rahaman
Sazzadur Rahaman

Reputation: 7126

Array index can not be more than Integer.MAX_VALUE in Java. In fact its much less than Integer.MAX_VALUE. So actually you can not put BigInteger as the size parameter, while creating an array.

For details see here.

Upvotes: 4

Related Questions