IDUtil { public static final String uuid3() { String ts = Long.toHexString(System.currentTimeMillis()); String hash = Integer.toHexString(ManagementFactory.getRuntimeMXBean().getName().hashCode()); int ranlen = 32 - ts.length() - hash.length(); StringBuilder buf = new StringBuilder(32); buf.append(ts); buf.append(hash); for (int i = 0; i < ranlen; i++) { buf.append(Integer.toHexString(ThreadLocalRandom.current().nextInt(0, 16))); } return buf.toString(); }  static final String storeID(int version, MagicFlag mf); static final String storeID(MagicFlag mf); static final MagicFlag toMagicFlag(String storeID); static final String uuid3();  }
@Test public void testUuid3() { long t = System.currentTimeMillis(); String ts = Long.toHexString(t); LOG.info("{} {} {}", t, ts, Long.parseLong(ts, 16)); String hash = Integer.toHexString(ManagementFactory.getRuntimeMXBean().getName().hashCode()); int ranlen = 32 - ts.length() - hash.length(); StringBuilder buf = new StringBuilder(32); buf.append(ts); buf.append(hash); for (int i = 0; i < ranlen; i++) { buf.append(Integer.toHexString(ThreadLocalRandom.current().nextInt(0, 16))); } LOG.info("{} {}", ranlen, buf.toString()); LOG.info("{}", Integer.toHexString(1)); }