如何在Java中创建一个10 ^ 3位大的BigInteger? [重复]

问题描述 投票:-1回答:1

这个问题在这里已有答案:

我想知道如何制作长度为10 ^ 3位的BigInteger,这是所述长度的最大值。

它将类似于此处发布的问题... How to create BigInteger of 256 bits with all bits set除了规模更大。

谢谢!

编辑:这就是我现在所拥有的:

for(int i = 3; i<= 8; i++){
for(int j = 0; j < 99; j++){
//Creates a Positive BigInteger of 10^i in bit size filled with ones
byte[] b = new byte[(10^i) / 8 + 1];
Arrays.fill(b, (byte) 127);
b[0] = 0;
java
1个回答
-1
投票

Biginteger没有上述或不变的限制。它是动态分配的。您必须制作自己的实现,以确保您的所述值是限制,如果这是您想要的。

您可能实际上想咨询constructors以查看适合您的代码的内容。

© www.soinside.com 2019 - 2024. All rights reserved.