Java – BigInteger or BigInteger?
•
Java
In Java, most basic types are signed (one bit for / –), so when I exceed the type limit, I can get unexpected results, such as negative numbers
Is there a better solution than using BigInteger because BigInteger has performance problems and you need to use class methods for basic arithmetic rather than language operators (Legacy readability)?
Solution
No, there is no better solution If you are using a value that cannot fit long or double, you will need to use a reference type like BigInteger. Java does not support operator overloading
Technically, I think you can do some mapping between signatures and unsigned values, but if your goal is clean and simple code, it's not the same thing at all
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
二维码