*/
public final Uint8 toUint8() {
if ((value & 0xFFFFFFFFFFFFFF00L) != 0) {
- UintConversions.throwIAE(toString(), 255);
+ throw iae(toString(), 255);
}
return Uint8.fromByteBits((byte) value);
}
*/
public final Uint16 toUint16() {
if ((value & 0xFFFFFFFFFFFF0000L) != 0) {
- UintConversions.throwIAE(toString(), 65535);
+ throw iae(toString(), 65535);
}
return Uint16.fromShortBits((short) value);
}
*/
public final Uint32 toUint32() {
if ((value & 0xFFFFFFFF00000000L) != 0) {
- UintConversions.throwIAE(toString(), 4294967295L);
+ throw iae(toString(), 4294967295L);
}
return Uint32.fromIntBits((int) value);
}
+ static IllegalArgumentException iae(final String value, final long max) {
+ // "Invalid range: 65536, expected: [[0..65535]]."
+ return new IllegalArgumentException("Invalid range: " + value + ", expected: [[0.." + max + "]].");
+ }
+
@Override
public final int hashCode() {
return Long.hashCode(value);
}
}
- static void throwIAE(final String value, final long max) {
- // "Invalid range: 65536, expected: [[0..65535]]."
- throw new IllegalArgumentException("Invalid range: " + value + ", expected: [[0.." + max + "]].");
- }
-
- private static void throwIAE(final int value, final int max) {
- // "Invalid range: 65536, expected: [[0..65535]]."
- throw new IllegalArgumentException("Invalid range: " + value + ", expected: [[0.." + max + "]].");
- }
-
private static void throwIAE(final long value, final long max) {
// "Invalid range: 65536, expected: [[0..65535]]."
throw new IllegalArgumentException("Invalid range: " + value + ", expected: [[0.." + max + "]].");