BigDecimalUtil { public static double add(long v1, long v2) { return add(NumberParserUtils.parseDouble(v1), NumberParserUtils.parseDouble(v2)); } private  BigDecimalUtil(); static double add(long v1, long v2); static double add(double v1, double v2); static BigDecimal add(String v1, String v2); static double add(double v1, double v2, int scale, RoundingMode roundingMode); static double sub(double v1, double v2); static BigDecimal sub(String v1, String v2); static double mul(double v1, double v2); static BigDecimal mul(String v1, String v2); static String div(String v1, String v2); static double div(double v1, double v2); static double div(double v1, double v2, int scale); static String div(String v1, String v2, int scale); static String div(String v1, String v2, int scale, int roundingMode); static double round(double v, int scale); static float convertsToFloat(double v); static float convertsToFloat(String v); static int convertsToInt(double v); static long convertsToLong(double v); static double returnMax(double v1, double v2); static double returnMin(double v1, double v2); static int compareTo(double v1, double v2); static String parseString(double value); static boolean isBigger(String val1, String val2); static boolean isNotSmaller(String val1, String val2); static boolean isBiggerThanZero(String val1); static boolean isEqualsZero(BigDecimal bigDecimal); static BigDecimal toBigDecimal(String value); static int compareTo(String val1, String val2);  }
@Test public void add() { double result = 0D; double v1 = 456456456.46554; double v2 = 4545889963333333.6456; BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); result = b1.add(b2).doubleValue(); Log.d("======", "得到结果result" + result); }
@Test public void add2() { BigDecimal result = BigDecimal.ZERO; String v1 = "456456456.46554"; String v2 = "4545889963333333.6456"; BigDecimal b1 = new BigDecimal(v1); BigDecimal b2 = new BigDecimal(v2); result = b1.add(b2); Log.d("======", "得到结果result---------->" + result); }