Really simple question but perhaps someone can explain. I have 2 lines of code:
long millisPerYear = 365*24*60*60*1000;
System.out.println("millis per year = " + millisPerYear);
I expect the output of 31 536 000 000 but I get 1 471 228 928.
If I remove the 1000 from the formula the answer is correct but the 1000 pushes it over the edge.
The variables format is Long
so it should be 264 in size, plenty big enough. I'm stumped as to why the values isn't being stored accurately.