
因为乘法会溢出32位整数。64位还可以:
public class Test{ public static void main(String[] args) { int intProduct = 24 * 60 * 60 * 1000 * 1000; long longProduct = 24L * 60 * 60 * 1000 * 1000; System.out.println(intProduct); // Prints 500654080 System.out.println(longProduct); // Prints 86400000000 }}显然,在乘法溢出之后,除法不会“撤消”该溢出。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)