Here you can find the source of getId()
public static int getId()
//package com.java2s; //License from project: Open Source License import java.util.concurrent.atomic.AtomicInteger; public class Main { private static final AtomicInteger id = new AtomicInteger(1); /**/*from w w w. j a v a 2s . co m*/ * @return a number, starting with 1 and incremented each time. This is * guaranteed to be unique _within this run of the jVM_, upto * overflow. * * @see #getUID() */ public static int getId() { return id.getAndIncrement(); } }