Rounding a float to two decimal places
by raja[ Edit ] 2010-01-28 15:58:53
The following code is one of the ways to round a float value to two decimal places.
float avg = 1.23567f;
avg *= 100;
avg = (float)Math.round(avg)/100;
System.out.println(avg);