@Test public void testCheck() { try { UInt.check(UInt.MIN_VALUE - 1); fail("Expected IllegalArgumentException!"); } catch (IllegalArgumentException expected) { } UInt.check(UInt.MIN_VALUE); UInt.check(UInt.MAX_VALUE); try { UInt.check(UInt.MAX_VALUE + 1); fail("Expected IllegalArgumentException!"); } catch (IllegalArgumentException expected) { } }
public static boolean check( final long l, final @CheckForNull String subject, final @CheckForNull String error) { if (MIN_VALUE <= l && l <= MAX_VALUE) return true; final StringBuilder message = new StringBuilder(); if (null != subject) message.append(subject).append(": "); if (null != error) message.append(error).append(": "); throw new IllegalArgumentException(message .append(l) .append(" is not within ") .append(MIN_VALUE) .append(" and ") .append(MAX_VALUE) .append(" inclusive.") .toString()); }
UInt { public static boolean check( final long l, final @CheckForNull String subject, final @CheckForNull String error) { if (MIN_VALUE <= l && l <= MAX_VALUE) return true; final StringBuilder message = new StringBuilder(); if (null != subject) message.append(subject).append(": "); if (null != error) message.append(error).append(": "); throw new IllegalArgumentException(message .append(l) .append(" is not within ") .append(MIN_VALUE) .append(" and ") .append(MAX_VALUE) .append(" inclusive.") .toString()); } }
UInt { public static boolean check( final long l, final @CheckForNull String subject, final @CheckForNull String error) { if (MIN_VALUE <= l && l <= MAX_VALUE) return true; final StringBuilder message = new StringBuilder(); if (null != subject) message.append(subject).append(": "); if (null != error) message.append(error).append(": "); throw new IllegalArgumentException(message .append(l) .append(" is not within ") .append(MIN_VALUE) .append(" and ") .append(MAX_VALUE) .append(" inclusive.") .toString()); } private  UInt(); }
UInt { public static boolean check( final long l, final @CheckForNull String subject, final @CheckForNull String error) { if (MIN_VALUE <= l && l <= MAX_VALUE) return true; final StringBuilder message = new StringBuilder(); if (null != subject) message.append(subject).append(": "); if (null != error) message.append(error).append(": "); throw new IllegalArgumentException(message .append(l) .append(" is not within ") .append(MIN_VALUE) .append(" and ") .append(MAX_VALUE) .append(" inclusive.") .toString()); } private  UInt(); static boolean check(
            final long l,
            final @CheckForNull String subject,
            final @CheckForNull String error); static boolean check(final long l); }
UInt { public static boolean check( final long l, final @CheckForNull String subject, final @CheckForNull String error) { if (MIN_VALUE <= l && l <= MAX_VALUE) return true; final StringBuilder message = new StringBuilder(); if (null != subject) message.append(subject).append(": "); if (null != error) message.append(error).append(": "); throw new IllegalArgumentException(message .append(l) .append(" is not within ") .append(MIN_VALUE) .append(" and ") .append(MAX_VALUE) .append(" inclusive.") .toString()); } private  UInt(); static boolean check(
            final long l,
            final @CheckForNull String subject,
            final @CheckForNull String error); static boolean check(final long l); static final long MIN_VALUE; static final long MAX_VALUE; static final int SIZE; }