Uid implements Serializable { @Nonnull public String toHexString() { final UUID uuid2 = UUID.fromString(uuid); final String msb = Long.toHexString(uuid2.getMostSignificantBits()); final String lsb = Long.toHexString(uuid2.getLeastSignificantBits()); final StringBuilder sb = new StringBuilder(); for (int i = 16 - msb.length(); i > 0; i--) { sb.append('0'); } sb.append(msb); for (int i = 16 - lsb.length(); i > 0; i--) { sb.append('0'); } sb.append(lsb); final String value = sb.toString(); assert value.length() == 32; return value; } Uid();  Uid(@Nonnull final String uuid); private  Uid(@Nonnull final UUID uuid); static boolean isValid(@Nullable final String id); @Nonnull static Uid<T> fromString(@Nonnull final String id); @Nonnull static Uid<T> fromHexString(@Nonnull final String id); @Nonnull String toHexString(); @SuppressWarnings({"unchecked", "UnusedParameters"}) @Nonnull Uid<T> as(@Nonnull final Class<T> ignored); boolean matchesFromString(@Nonnull final String uid); @Override boolean equals(@Nullable final Object obj); @Override int hashCode(); @Override @Nonnull String toString();  }
@Test public void testToHexString() { LOG.info("testToHexString"); final Uid<Object> a = new Uid<>(); Assert.assertEquals(a.toString().replaceAll("-", ""), a.toHexString()); }