|
|
Rounding a float to two decimal places - JSP/Java
|
Views : 562
|
|
Tagged in : JSP-Java
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
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);
|
|
By raja, On - 2010-01-28 |
|
|
|