为了账号安全,请及时绑定邮箱和手机立即绑定

java怎么实现大数输入输出与加减乘除。初学者求指教。

java怎么实现大数输入输出与加减乘除。初学者求指教。

yeyeyy 2017-03-09 12:06:53
查看完整描述

2 回答

?
qq_小二姐___0

TA贡献1条经验 获得超0个赞

bigdecimal
查看完整回答
反对 回复 2017-03-10
?
yanrun

TA贡献317条经验 获得超240个赞

用BigInteger或者BigDecimal吧

查看完整回答
反对 回复 2017-03-09
  • yeyeyy
    yeyeyy
    能举个例子不?
  • yanrun
    yanrun
    package test; import java.math.BigInteger; public class Test { public static void main(String[] args) { BigInteger i = new BigInteger(Integer.MAX_VALUE + ""); BigInteger n = new BigInteger("2"); System.out.println(i.add(n)); // + System.out.println(i.subtract(n)); // - System.out.println(i.multiply(n)); // * System.out.println(i.divide(n)); // / } }
  • 2 回答
  • 0 关注
  • 2738 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信