【正文】
} public static double divide(double v1,double v2,int scale, int round_mode){ if(scale 0) { throw new IllegalArgumentException(The scale must be a positive integer or zero)。 } BigDecimal b1 = new BigDecimal((v1))。 BigDecimal b2 = new BigDecimal((v2))。 return (b2, scale, round_mode).doublue()。 } 楊教授工作室 精心創(chuàng)作的優(yōu)秀程序員 職業(yè)提升必讀系列資料 楊教授工作室,版權(quán)所有,盜版必究 , 3/10 頁 public static String divide(String v1, String v2){ return divide(v1, v2, DEFAULT_DIV_SCALE)。 } public static String divide(String v1, String v2, int scale){ return divide(v1, v2, DEFAULT_DIV_SCALE, )。 } public static String divide(String v1, String v2, int scale, int round_mode){ if(scale 0){ throw new IllegalArgumentException(The scale must be a positive integer or zero)。 } BigDecimal b1 = new BigDecimal(v1)。 BigDecimal b2 = new BigDecimal(v2)。 return (b2, scale, round_mode).toString()。 } public static double round(double v,int scale){ return round(v, scale, )。 } public static double round(double v, int scale, int round_mode){ if(scale0){ throw new IllegalArgumentException(The scale must be a positive integer or zero)。 } BigDecimal b = new BigDecimal((v))。 return (scale, round_mode).doublue()。 } public static String round(String v, int scale){ return round(v, scale, )。 楊教授工作室 精心創(chuàng)作的優(yōu)秀程序員 職業(yè)提升必讀系列資料 楊教授工作室,版權(quán)所有,盜版必究 , 4/10 頁 } public static String round(String v, int scale, int round_mode){ if(scale0){ throw new IllegalArgumentException(The scale must be a positive integer or zero)。 } BigDecimal b = new BigDecimal(v)。 return (scale, roun