Rounding the Decimal to 1.00 and 0.10 in Android -
as title, how round decimal 1.00 if number 1.01,1.02,1.03,1.04 , round decimal 0.10 if number 0.05,0.06,0.07,0.08,0.09
you can try below code:
private static void roundoff(double num) { double intpart = (int) num; double rondededoffnum = intpart+ math.round((num- intpart)*10)/10.0; system.out.println(rondededoffnum); }
Comments
Post a Comment