java spring nextfloat with only 2 decimal places code example
Example 1: java 2 decimals
double res = Math.round(a * 100) / 100;
Example 2: android java convert double to 2 decimal places
String stringDecimal = String.format("%.2f, d");
double res = Math.round(a * 100) / 100;
String stringDecimal = String.format("%.2f, d");