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

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -