Here you can find the source of tilNextMillis(long lastTimestamp)
private static long tilNextMillis(long lastTimestamp)
//package com.java2s; public class Main { private static long tilNextMillis(long lastTimestamp) { long timestamp = timeGen(); while (timestamp <= lastTimestamp) { timestamp = timeGen();//from w w w .j a v a2 s . c o m } return timestamp; } private static long timeGen() { return System.currentTimeMillis(); } }