我需要处理大量数据(范围1E100 - 1E200)。但是,那 BigInteger
class,通常看起来很合适,在初始化期间不识别科学格式的字符串,也不支持转换为格式的字符串。
BigDecimal d = new BigDecimal("1E10"); //works
BigInteger i1 = new BigInteger("10000000000"); //works
BigInteger i2 = new BigInteger("1E10"); //throws NumberFormatException
System.out.println(d.toEngineeringString()); //works
System.out.println(i1.toEngineeringString()); //method is undefined
有办法吗?我无法想象这样的类的设计是假设用户必须在输入中输入数百个零。