BigInteger 比 Long 和 Int 大?
BigInteger bigger than the Long and Int?
我正在做一个将使用非常大的数字的程序,即使是最慢的速度也会有太多的工作。
我的问题是:big_integer 比普通的 int 和 long 慢吗?
long number = 12;
BigInteger number2 = 12;
public void add()
{
number += 1;
}
public void add2()
{
number2 += 1;
}
现在哪个更快?
是的,BigInteger 类型比 int 或 long 慢。
但是对于非常大的数字的整数计算,需要 BigInteger。
我正在做一个将使用非常大的数字的程序,即使是最慢的速度也会有太多的工作。 我的问题是:big_integer 比普通的 int 和 long 慢吗?
long number = 12;
BigInteger number2 = 12;
public void add()
{
number += 1;
}
public void add2()
{
number2 += 1;
}
现在哪个更快?
是的,BigInteger 类型比 int 或 long 慢。
但是对于非常大的数字的整数计算,需要 BigInteger。