Format a number with "000000.000" in Java
Description
The following code shows how to format a number with "000000.000".
Example
/*w w w . j av a 2s . com*/
import java.text.DecimalFormat;
public class Main {
public static void main(String[] argv) {
DecimalFormat myFormatter = new DecimalFormat("000000.000");
String output = myFormatter.format(123123123.1231231);
System.out.println(output);
}
}
The code above generates the following result.