I want to get a function which rounds the double value into two significant digits now i m using the below function
private static DecimalFormatSymbols DFS;
private static DecimalFormat myFormatter;
public static String DoubleToFormatedString(double value) {
DFS = new DecimalFormatSymbols();
DFS.setDecimalSeparator('.');
myFormatter = new DecimalFormat("############.##");
myFormatter.setDecimalFormatSymbols(DFS);
return myFormatter.format(value);
}
but with this function eg: i m getting a rounded number 2.6, i need to get this like 2.60. '0'should come to the right of 1 significant num. what change should make? or any other way plz help me