Here you can find the source of getReply()
private static int getReply()
//package com.java2s; import java.util.concurrent.atomic.AtomicInteger; public class Main { private static AtomicInteger replyNO = new AtomicInteger(0); private static int getReply() { if (replyNO.get() < 10000000) { return replyNO.getAndIncrement(); } else {// ww w .j av a 2 s .co m replyNO.set(0); return replyNO.getAndIncrement(); } } }