HexCodec { public static long lowerHexToUnsignedLong(CharSequence lowerHex) { int length = lowerHex.length(); if (length < 1 || length > 32) throw isntLowerHexLong(lowerHex); int beginIndex = length > 16 ? length - 16 : 0; return lowerHexToUnsignedLong(lowerHex, beginIndex); } HexCodec(); static long lowerHexToUnsignedLong(CharSequence lowerHex); static long lowerHexToUnsignedLong(CharSequence value, int beginIndex); static long lenientLowerHexToUnsignedLong(CharSequence value, int beginIndex,
    int endIndex); static String toLowerHex(long v); static void writeHexLong(char[] data, int pos, long v);  }
@Test public void lowerHexToUnsignedLong_downgrades128bitIdsByDroppingHighBits() { assertThat(lowerHexToUnsignedLong("463ac35c9f6413ad48485a3953bb6124")) .isEqualTo(lowerHexToUnsignedLong("48485a3953bb6124")); }
@Test public void lowerHexToUnsignedLongTest() { assertThat(lowerHexToUnsignedLong("ffffffffffffffff")).isEqualTo(-1); assertThat(lowerHexToUnsignedLong(Long.toHexString(Long.MAX_VALUE))).isEqualTo(Long.MAX_VALUE); try { lowerHexToUnsignedLong("0"); failBecauseExceptionWasNotThrown(NumberFormatException.class); } catch (NumberFormatException e) { } try { lowerHexToUnsignedLong(Character.toString((char) ('9' + 1))); failBecauseExceptionWasNotThrown(NumberFormatException.class); } catch (NumberFormatException e) { } try { lowerHexToUnsignedLong(Character.toString((char) ('0' - 1))); failBecauseExceptionWasNotThrown(NumberFormatException.class); } catch (NumberFormatException e) { } try { lowerHexToUnsignedLong(Character.toString((char) ('f' + 1))); failBecauseExceptionWasNotThrown(NumberFormatException.class); } catch (NumberFormatException e) { } try { lowerHexToUnsignedLong(Character.toString((char) ('a' - 1))); failBecauseExceptionWasNotThrown(NumberFormatException.class); } catch (NumberFormatException e) { } try { lowerHexToUnsignedLong("fffffffffffffffffffffffffffffffff"); failBecauseExceptionWasNotThrown(NumberFormatException.class); } catch (NumberFormatException e) { } try { lowerHexToUnsignedLong(""); failBecauseExceptionWasNotThrown(NumberFormatException.class); } catch (NumberFormatException e) { } try { lowerHexToUnsignedLong("rs"); failBecauseExceptionWasNotThrown(NumberFormatException.class); } catch (NumberFormatException e) { } }