On 20 January 2012 17:53, Ulf Zibis <[email protected]> wrote: > Am 21.01.2012 01:35, schrieb Joseph Darcy: > >> On 1/19/2012 8:05 AM, Ulf Zibis wrote: >> >>> But again, moving the entire method to BigInteger would additionally >>> avoid to clown around with the available BigInteger's public APIs. Having >>> the method at BigInteger would allow elegant direct access to the private >>> value fields. >>> >> >> If the operation in question starts becoming a bottleneck, these >> alternate implementations can be explored. >> > But the alternatives for potentially faster algorithms would be limited if > you stick BigInteger toUnsignedBigInteger(long i) to class Long.
There's no reason Long and BigInteger can't conspire to achieve this without changing their APIs, if it proves interesting. It's not completely straightforward since they are in different packages, but perfectly possible using a sun.* intermediary. Éamonn
