Prevent issue where a negative value is passed to Thread.sleep()