code: public static long getMaxUnsignedValueOnBytes(final int width) {
      if (width < 0 || width > 8) {
        throw new IllegalArgumentException("Width must be from 1 to 8 bytes: " 
            + width);
      }
      if (width < 8) {
        return ((long) 1 << width * Byte.SIZE) - 1;
      } else {
        return Long.MAX_VALUE;
      }
    }
docs: Simple helper to calculate the max value for any width of long from 0 to 8
  bytes.
  @param width The width of the byte array we're comparing
  @return The maximum unsigned integer value on {@code width} bytes. Note:
  If you ask for 8 bytes, it will return the max signed value. This is due
  to Java lacking unsigned integers... *sigh*.
  @since 2.2