在Java中制作大小为biginteger的bigInteger数组 [英] making an array of bigInteger of size biginteger in java

查看:213
本文介绍了在Java中制作大小为biginteger的bigInteger数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作大小为biginteger的biginteger数组.

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....

推荐答案

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; 

这篇关于在Java中制作大小为biginteger的bigInteger数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆