Why does the below calculation produce a negative value?
long interval = 0; interval = ((60000 * 60) * 24) * 30;
Your value is 2592000000 which is bigger than the maximum signed integer value 2^31 (2147483648). This is called integer overflow, the result overflows into negative.