Package com. hsun. test; import static java. lang. system. out; import java. math. bigDecimal; public class BigDecimalTest {public static void main (String [] args) {double a = 1.1; double B = 2.2; out. println (a + B); // Add 3.30020.0000000000003out.println (a-B); // subtract-1.1out.println (a * B); // multiply by 2.42000000000000000004out.println (a/B ); // except 0.5out.println (BigDecimal. valueOf (). add (BigDecimal. valueOf (B); // Add 3.3out.println (BigDecimal. valueOf (). subtract (BigDecimal. valueOf (B); // minus-1.1out.println (BigDecimal. valueOf (). multiply (BigDecimal. valueOf (B); // multiply by 2.42out.println (BigDecimal. valueOf (). divide (BigDecimal. valueOf (B); // except 0.5 double c = 1.01; double d = 2.02; out. println (BigDecimal. valueOf (c ). divide (BigDecimal. valueOf (d), 2, BigDecimal. ROUND_HALF_UP); // after the decimal point, the two digits are rounded to 0.50out.println (BigDecimal. valueOf (c ). multiply (BigDecimal. valueOf (d )). setScale (2, BigDecimal. ROUND_HALF_UP); // round the two digits after the decimal point to 2.42 }}