Unsigned long in Java

Currently, I am using signed values, -2^63 to 2^63-1. Now I need the same range (2 * 2^64), but with positive values only. I found the java documentations mentioning unsigned long, which suits this use.

I tried to declare 2^64 to a Long wrapper object, but it still loses the data, in other words, it only captures till the Long.MAX_VALUE, so I am clearly missing something. Is BigInteger the signed long that Java supports?

Is there a definition or pointer as to how to declare and use it?

Leave a Comment