new BigInteger(String) performance / complexity

后端 未结 3 2022
猫巷女王i
猫巷女王i 2021-01-11 15:08

I\'m wondering about the performance/complexity of constructing BigInteger objects with the new BigInteger(String) constructor

3条回答
  •  醉话见心
    2021-01-11 15:47

    The O(n^2) effort is caused by the decimal to binary conversion if the BigInteger is specified as decimal digits.

    Also, 10^7 digits is a really huge number. For typical cryptographic algorithms like RSA you would deal with 10^3 to 10^4 digits. Most of the BigInteger operations are not optimized for such a large number of digits.

提交回复
热议问题