Skip to content
Is there anyway to delay code in java on here?
Profile icon
MisledWater79

I’m trying to make something in java and I don’t know how to delay it.

You are viewing a single comment. View All
Profile icon
PDales

long elapsedTime, timeStart;
long milliseconds = 5000;
timeStart = System.currentTimeMillis(); //new Date().getTime();
while (true)
{
elapsedTime = System.currentTimeMillis() - timeStart;
if (elapsedTime > milliseconds)
{
break;
}
}

Profile icon
MisledWater79

@PDales
How did you find this post lol, it was over a year ago i posted this