You can use
Thread.yeild()
instead of sleep.
If a thread desires to halt its execution to allow an opportunity for the other threads of equal priority, then we should choose the yield method.Because Thread.sleep blocks the main thread.