*/
public static void busySpin(final int value, final TimeUnit unit)
{
if (value >= 0)
{
val sw = Stopwatch.startNew();
switch(unit)
{
case DAYS:
while (sw.getElapsedSeconds() < value * 3600 * 24);
break;
case HOURS:
while (sw.getElapsedSeconds() < value * 3600);
break;
case MINUTES:
while (sw.getElapsedSeconds() < value * 60);
break;
case SECONDS:
while (sw.getElapsedSeconds() < value);
break;
case MILLISECONDS:
while (sw.getElapsedMillis() < value);
break;
case MICROSECONDS:
while (sw.getElapsedMicros() < value);
break;
case NANOSECONDS:
while (sw.getElapsedNanos() < value);
break;
default:
throw new IllegalStateException("Unrecognised time unit: " + unit);
}
}