BigInteger和BigDecimal的实例
2015-09-02 18:44
330 查看
import java.math.*; public class LargeFactorial { public static void main(String[] args) { System.out.println("50! is \n"+factorial(50)); } public static BigInteger factorial(long n) { BigInteger result=BigInteger.ONE; for(int i=1;i<=n;i++) { result=result.multiply(new BigInteger(i+"")); } return result; } }
相关文章推荐
- MySQL用户远程登录以及root密码设置
- 我的游戏开发笔记(六):NavMeshAgent及自动寻径(跳跃)。
- 我的渺小
- js学习
- OC 中#pragma mark [-] xxx
- HTML5离线存储
- OPS - Parrallel Control System
- Node.js最新Web技术栈(2015年5月)
- HDU 4634 Swipe Bo (BFS)
- FZU 2195 检查站点 (树形dp)
- [JavaScript 随笔] 垃圾回收
- 【LeetCode】之Remove Duplicates from Sorted Array
- 运用comparable类对数据对象做排序
- 将搜狗输入法(拼音键盘)作为默认输入键盘
- spark core源码分析11 RDD缓存及checkpoint
- android 按两次返回到桌面
- HDU 4467 Graph
- 分析HTTP请求返回304状态码
- 771 密钥解密【字符串处理】
- 游标