Why this code in java gives negative value?
long ttt = (60 * 60 * 1000 * 24 * 26);
System.out.println(ttt);
Result which comes as on eclipse console -2134967296
?
Anything silly I am doing, may be it crossed int range I guess?
Why this code in java gives negative value?
long ttt = (60 * 60 * 1000 * 24 * 26);
System.out.println(ttt);
Result which comes as on eclipse console -2134967296
?
Anything silly I am doing, may be it crossed int range I guess?
Because 60 * 60 * 1000 * 24 * 25
overflows in the int
range.
Make one of them a long
so that promotion occurs
60L * 60 * 1000 * 24 * 25