1

i am trying to make an array of biginteger of size biginteger.

public class Polynomial4   
{  
private BigInteger[] coef;      
private BigInteger deg;   
public Polynomial4(BigInteger a,BigInteger b)   
{  
coef =  new BigInteger[b+1];// here its giving the error   
coef[b] = a; // here also its showing error *  ///required int found Biginteger  

}    

}    

please help me....thanks in advance....

PermGenError
  • 45,977
  • 8
  • 87
  • 106
vdevid
  • 23
  • 1
  • 1
  • 5
  • 1
    It makes no sense to use a BigInteger for the size of an array. The maximum theoretical size [is about Integer.MAX_VALUE](http://stackoverflow.com/questions/3038392/do-java-arrays-have-a-maximum-size) (although most systems can't even create arrays that big) –  Feb 23 '13 at 09:17

1 Answers1

5

BigInteger has an intValue method. which converts BigInteger into an int primitive.arrays expect an int as its size while BigInteger is an object.

    coef =  new BigInteger[b.intValue()+1];
       coef[b.intValue()] = a; 
PermGenError
  • 45,977
  • 8
  • 87
  • 106