So I am writing a Java code to represent a heap sort and to represent the operation I need to have a waiting function which will wait between different operation but I am no
There's a simpler ( But possibly not better ) way to sleep that I have been using:
public static void sleep(int amt) // In milliseconds
{
long a = System.currentTimeMillis();
long b = System.currentTimeMillis();
while ((b - a) <= amt)
{
b = System.currentTimeMillis();
}
}
This will essentially cause everything your program is doing to cease until the time runs out. It also can cause a bit of lag. You have been warned.