Java tutorial
//package com.java2s; import java.math.BigDecimal; public class Main { public static float numMathMul(float d1, float d2) { BigDecimal b1 = new BigDecimal(d1); BigDecimal b2 = new BigDecimal(d2); float res = b1.multiply(b2).setScale(1, BigDecimal.ROUND_HALF_UP).floatValue(); return res; } }