Rounding Logic for decimal digits in java -


this question has answer here:

i need rounding logic in following pattern..for 2.23 should 2.2 ,for 2.26 should 2.3... please out

double = <ur number>; double roundoff = (double) math.round(a*10)/10; 

hope you. here 2.25 round off 2.3