大数类java.math.BigInteger
2012-10-02 13:36
423 查看
import java.math.BigInteger;
/**
*大数类
*/
public class dashu {
public static void main(String[] args) {
BigInteger one = new BigInteger("1");
BigInteger two = new BigInteger("2");
BigInteger three = new BigInteger("3");
BigInteger sum = new BigInteger("0");
/*sum=sum.add(one);
sum=sum.add(two);
sum=sum.add(three);
System.out.println(sum.toString());//6
*/
sum.add(one);
sum.add(two);
sum.add(three);
System.out.println(sum.toString());//0
}
}
/**
*大数类
*/
public class dashu {
public static void main(String[] args) {
BigInteger one = new BigInteger("1");
BigInteger two = new BigInteger("2");
BigInteger three = new BigInteger("3");
BigInteger sum = new BigInteger("0");
/*sum=sum.add(one);
sum=sum.add(two);
sum=sum.add(three);
System.out.println(sum.toString());//6
*/
sum.add(one);
sum.add(two);
sum.add(three);
System.out.println(sum.toString());//0
}
}
相关文章推荐
- java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Integer解决
- java.math.BigDecimal 和java.math.BigInteger
- 【Java】-BigInteger大数类的使用【超强Java大数模板 总结】
- java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Integer
- Java基础-14总结正则表达式,Pattern,Mactcher,Math,BigInteger,BigDeximal,System等
- java.math.BigInteger类型的数据转成int
- java.math.BigInteger cannot be cast to java.lang.Long异常
- java基础 基本包装类 System Math Array BigInteger BigDecimal
- JAVA BigInteger(大数类)HDU 1002 1042
- 十三、java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
- java.math.BigInteger cannot be cast to java.lang.Integer
- java.math.BigInteger使用心得总结
- java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.Integer
- java.math.BigInteger cannot be cast to java.lang.Long
- java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Integer
- java.math.BigInteger使用心得总结
- Java学习笔记之常用方法类(三) Data和Calendar类、Math、BigInteger和Random类、Random类
- Java基础-14总结正则表达式,Pattern,Mactcher,Math,BigInteger,BigDeximal,System等
- java.math.BigInteger cannot be cast to java.lang.Long