I'm a .Net developer but I would guess there's a Java equivalent of this...
static int i = 1;
static System.Timers.Timer timer = new System.Timers.Timer();
static void Main(string[] args)
{
timer.Interval = 10; //milliseconds
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
timer.Enabled = true;
timer.Start();
//let the timer complete... (3000 to show the output stops)
System.Threading.Thread.CurrentThread.Join(3000);
}
static void timer_Elapsed(object sender, ElapsedEventArgs e)
{
Console.WriteLine(i++);
timer.Enabled = (i < 101);
}