参见http://en.wikipedia.org/wiki/Arithmetic_overflow
要在Java中修复,请尝试使用a
long代替。
int progress = (int) ((byte_counter * 100L) / size);
或相反的操作顺序
int progress = (int) (((float) byte_counter) / size) * 100);

参见http://en.wikipedia.org/wiki/Arithmetic_overflow
要在Java中修复,请尝试使用a
long代替。
int progress = (int) ((byte_counter * 100L) / size);
或相反的操作顺序
int progress = (int) (((float) byte_counter) / size) * 100);