BigDecimalUtil { public static String div(String v1, String v2) { return div(v1, v2, DEF_DIV_SCALE); } 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 div(){ double result = 0D; double v1 = 4545889963333333.6456; double v2 = 456456456.46554; BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); result = b1.divide(b2, 3, BigDecimal.ROUND_HALF_UP).doubleValue(); Log.d("======", "得到结果result---------->" + new BigDecimal(result).toPlainString()); Log.d("======", "得到结果result---------->" + BigDecimal.valueOf(result).toPlainString()); }