Possible Duplicate:
Round a double to 2 significant figures after decimal point
The code below works
import java.text.DecimalFormat;
public class Test {
public static void main(String[] args){
double x = roundTwoDecimals(35.0000);
System.out.println(x);
}
public static double roundTwoDecimals(double d) {
DecimalFormat twoDForm = new DecimalFormat("#.00");
twoDForm.setMinimumFractionDigits(2);
return Double.valueOf(twoDForm.format(d));
}
}
it results to 35.0. How to forced the minimum number of decimal places? The output I want is 35.00