Java Code Examples for java.text.DecimalFormat.getNumberInstance()

The following are Jave code examples for showing how to use getNumberInstance() of the java.text.DecimalFormat class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: fdt   File: Utils.java   Source Code and License Vote up 4 votes
private static String speedDecimalFormat(final double no) {
    final DecimalFormat SPEED_DECIMAL_FORMAT = ((DecimalFormat) DecimalFormat.getNumberInstance());
    SPEED_DECIMAL_FORMAT.applyPattern("##0.000");
    return SPEED_DECIMAL_FORMAT.format(no);
}
 
Example 2
Project: fdt   File: Utils.java   Source Code and License Vote up 4 votes
public static String percentDecimalFormat(final double no) {
    final DecimalFormat PERCENT_DECIMAL_FORMAT = ((DecimalFormat) DecimalFormat.getNumberInstance());
    PERCENT_DECIMAL_FORMAT.applyPattern("00.00");
    return PERCENT_DECIMAL_FORMAT.format(no);
}