I am facing issue in below code -
int precision = 3;
String value1 = "2.0425";
String value2 = "2.1425";
DecimalFormat dfForm = new DecimalFormat();
dfForm.setMinimumFractionDigits(precision);
dfForm.setMaximumFractionDigits(precision);
System.out.println(dfForm.format(value1));
System.out.println(dfForm.format(value2));
Output -
2.042
2.143
1st output is expected to be 2.043. Can anyone help me in this?