在java中创建一个大小为biginteger的bigInteger数组

时间:2013-02-23 08:48:06

标签: java 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  

}    

}    

请帮助我......提前致谢....

1 个答案:

答案 0 :(得分:5)

BigInteger intValue方法。它将BigInteger转换为int原语.arrays期望int为其大小,而BigInteger为对象。

    coef =  new BigInteger[b.intValue()+1];
       coef[b.intValue()] = a;