0

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.

1
  • 1
    Even if Java allowed you to initialize an array this big, do you have enough ram to store 17!=355687428096000 pointers to String? Assuming each pointer is 8 byte, you'd need 2845TB of RAM. Commented Aug 24, 2013 at 13:56

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. forgot this concept.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.