There is a quirk with Math.Round. It defaults to rounding to the nearest even number, so 1.5 = 2, 2.5 = 2. If you use Math.Round(2.5, MidpointRounding.AwayFromZero) it will round to the nearest whole number.

with the 0 being the number of decimal places you would like to round to

Have you checked this? None of the overloads for .Parse accept the input types you have shown. It accepts a string and optionally an IFormatProvider and/or a NumberStyle.

Also, people keep pointing to Math.Round() but if you read the article ddanbe linked to you will see that there are several commonly used 'tie breaker' situations when rounding .5 values. The default in visual studio is to Round to the Nearest Even number. This is the tiebreaker used in bookkeeping and gives the most accurate summing of values.

It isn't, however, the method most people use. You can specify overload the Math.Round method to specify the MidpointRounding method to use. That way you can be sure of the results your rounding will yield.

Dont mean to go on, but it can trip you up if you dont know its there ;)

public class Main {
public static void main(String[] args) {
long timeCheck;
long periodOfTime;
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2);
long initialDelay = 0; // ...