Here you can find the source of createId(final Long baseId)
public static synchronized Long createId(final Long baseId)
//package com.java2s; import java.util.concurrent.atomic.AtomicLong; public class Main { private static final AtomicLong ID_SEQUENCE = new AtomicLong(0l); public static synchronized long createId() { return ID_SEQUENCE.incrementAndGet(); }// w ww . j ava 2 s . com public static synchronized Long createId(final Long baseId) { final long delta = ((baseId != null ? baseId.longValue() : 0l) - ID_SEQUENCE.get()); long newId = (delta > 0 ? ID_SEQUENCE.addAndGet(delta) : createId()); return Long.valueOf(newId); } }