How is BigInteger stored

I need to generate 512 bits of BigInts, but I'm not sure which of the two below is true:

Does 512 bit mean 512 digits 1010101010...001010, which are then converted to the decimal number that it represents?

Or does that mean 512 digits 0-9, so basically a 512-digit number with numbers from 0 to 9? Something like 12414124124 .... 54543 = 512 digits.

+2
source share
1 answer

From the source code they are stored in an array int

BigInteger : int. "", int (mag [0]) . BigInteger. , , BigInteger .

118 
119     int[] mag;
120 
121     // These "redundant fields" are initialized with recognizable nonsense
122     // values, and cached the first time they are needed (or never, if they
123     // aren't needed).
124 
+4

Source: https://habr.com/ru/post/1616893/


All Articles