public static void main(String[] args) throws Exception { long a = Long.MAX_VALUE; long b = Long.MAX_VALUE; BigDecimal ba = new BigDecimal(String.valueOf(a)); BigDecimal bb = new BigDecimal(String.valueOf(b)); BigDecimal bc = ba.multiply(bb); System.out.println(String.valueOf(a)); System.out.println(String.valueOf(b)); System.out.println(bc); }
9223372036854775807
9223372036854775807
85070591730234615847396907784232501249
两个Long类型相乘溢出怎么解决,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/m3Lee/p/3863223.html