To format a number with 4 decimals, use String.format("%.4f", num)
as in the following example:
public class k {
public static void main(String argv[]) {
String number = "1.0E7";
Double num = Double.valueOf(number);
System.out.println("Double="+ num + " Formatted Double=" + String.format("%.4f", num));
}
}
Output:
String=1.0E7 Formatted Double=10000000,0000
As you can see, my locale uses ,
as decimal separator.