Here you can find the source of toStringLong(long id)
public static String toStringLong(long id)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final long xFFFFFF = 0xFFFFFF; private static final int xFF = 0xFF; private static final DateFormat SDF_MED = SimpleDateFormat.getDateTimeInstance( // SimpleDateFormat.MEDIUM, // SimpleDateFormat.MEDIUM); public static String toStringLong(long id) { long time = (System.currentTimeMillis() >> 42 << 42) + (id >> 22); long inc = (id >> 8) & xFFFFFF; long instanceId = id & xFF; return id + " (DEC)"// + "\n" + toString(id) + " (HEX)" // + "\ntime=" + SDF_MED.format(new Date(time)) + ", instanceId=" + instanceId + ", inc=" + inc; }//from ww w . jav a2 s . co m public static String toString(long id) { String hex = Long.toHexString(id); return hex.subSequence(0, 8) // + "-" + hex.substring(8, 14) // + "-" + hex.substring(14); } }