@Test public void checkUnsignedBoundsLongHex() { ByteValue.checkUnsignedBounds(0x0_00_00, 2); ByteValue.checkUnsignedBounds(0x0_FF_FF, 2); }
public static void checkUnsignedBounds(long value, int numberOfBytes) { double upperBound = Math.pow((double) 2, (double) (8 * numberOfBytes)); if (value < 0 || value >= upperBound) { throw new IllegalArgumentException("Value must between 0 and " + upperBound + ". Was " + value); } }
ByteValue implements ByteReadable { public static void checkUnsignedBounds(long value, int numberOfBytes) { double upperBound = Math.pow((double) 2, (double) (8 * numberOfBytes)); if (value < 0 || value >= upperBound) { throw new IllegalArgumentException("Value must between 0 and " + upperBound + ". Was " + value); } } }
ByteValue implements ByteReadable { public static void checkUnsignedBounds(long value, int numberOfBytes) { double upperBound = Math.pow((double) 2, (double) (8 * numberOfBytes)); if (value < 0 || value >= upperBound) { throw new IllegalArgumentException("Value must between 0 and " + upperBound + ". Was " + value); } } protected  ByteValue(byte... value); protected  ByteValue(ByteBuf byteBuf); }
ByteValue implements ByteReadable { public static void checkUnsignedBounds(long value, int numberOfBytes) { double upperBound = Math.pow((double) 2, (double) (8 * numberOfBytes)); if (value < 0 || value >= upperBound) { throw new IllegalArgumentException("Value must between 0 and " + upperBound + ". Was " + value); } } protected  ByteValue(byte... value); protected  ByteValue(ByteBuf byteBuf); static void checkUnsignedBounds(long value, int numberOfBytes); static void checkUnsignedBounds(BigInteger value, int numberOfBytes); @Override byte[] getBytes(); @Override ByteBuf getByteBuf(); @Override long getCalculatedLength(); static ByteValue of(byte... values); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
ByteValue implements ByteReadable { public static void checkUnsignedBounds(long value, int numberOfBytes) { double upperBound = Math.pow((double) 2, (double) (8 * numberOfBytes)); if (value < 0 || value >= upperBound) { throw new IllegalArgumentException("Value must between 0 and " + upperBound + ". Was " + value); } } protected  ByteValue(byte... value); protected  ByteValue(ByteBuf byteBuf); static void checkUnsignedBounds(long value, int numberOfBytes); static void checkUnsignedBounds(BigInteger value, int numberOfBytes); @Override byte[] getBytes(); @Override ByteBuf getByteBuf(); @Override long getCalculatedLength(); static ByteValue of(byte... values); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }