java - Why does this not result in 1000? -


possible duplicate:
java problem-whats reason behind , probable output

long milli=24*60*60*1000; long micro=24*60*60*1000*1000; long result=micro/milli; 

the result should 1000 not. why work when use 24*60*60*1000*1000l?

can tell me reason this?

the trouble calculation done on ints , casted long, , unfortunately 24*60*60*1000*1000 won't fit in int , wraps around. like

long micro=24l*60*60*1000*1000; 

to force last multiplication done on longs.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -