Modify BigInteger after Java partition

I've read a lot here and can't completely find out why this line is wrong:

ArrayList <BigInteger> data = new ArrayList();
int [] primes = new int[25];    
...
// Some initializing
...
data.get(i) = data.get(i).divide( BigInteger.valueOf( primes[place] ) ); //<----
...
// Rest of the code

Required: variable; Discovery: value What did I do wrong?

Solution

First, you should fix your raw type (I prefer the list interface)

List<BigInteger> data = new ArrayList<>();

Then you need to use set because you can't assign the return value of that get

data.set(i,data.get(i).divide(BigInteger.valueOf(primes[place])));

In addition, it is worth noting that BigInteger (s) (according to Javadoc) is an immutable arbitrary precision integer

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>