+ /**
+ * Return an interned (shared) instance equivalent to this object. This may return the same object.
+ *
+ * @return A shared instance.
+ */
+ public final Uint64 intern() {
+ return value >= 0 && value < CACHE_SIZE ? this : INTERNER.intern(this);
+ }
+
+ /**
+ * Convert this value to a {@link BigInteger}.
+ *
+ * @return A BigInteger instance
+ */
+ public final BigInteger toJava() {
+ // FIXME: ditch the Guava transition
+ return toGuava().bigIntegerValue();
+ }
+
+ /**
+ * Convert this value to an {@link UnsignedLong}.
+ *
+ * @return An UnsignedLong instance
+ */
+ public final UnsignedLong toGuava() {
+ return UnsignedLong.fromLongBits(value);
+ }
+
+ /**
+ * Convert this value to a {@code Uint8}.
+ *
+ * @return A Uint8
+ * @throws IllegalArgumentException if this value is greater than 255.
+ */
+ public final Uint8 toUint8() {
+ if ((value & 0xFFFFFFFFFFFFFF00L) != 0) {
+ UintConversions.throwIAE(toString(), 255);
+ }
+ return Uint8.fromByteBits((byte) value);
+ }
+
+ /**
+ * Convert this value to a {@code Uint16}.
+ *
+ * @return A Uint16
+ * @throws IllegalArgumentException if this value is greater than 65535.
+ */
+ public final Uint16 toUint16() {
+ if ((value & 0xFFFFFFFFFFFF0000L) != 0) {
+ UintConversions.throwIAE(toString(), 65535);
+ }
+ return Uint16.fromShortBits((short) value);
+ }
+
+ /**
+ * Convert this value to a {@code Uint64}.
+ *
+ * @return A Uint32
+ * @throws IllegalArgumentException if this value is greater than 4294967295.
+ */
+ public final Uint32 toUint32() {
+ if ((value & 0xFFFFFFFF00000000L) != 0) {
+ UintConversions.throwIAE(toString(), 4294967295L);
+ }
+ return Uint32.fromIntBits((int) value);
+ }
+