I currently use the following code to print a double:
return String.format(\"%.2f\", someDouble);
This works well, except that Java uses my
Way too late but as other mentioned here is sample usage of NumberFormat (and its subclass DecimalFormat)
public static String format(double num) {
DecimalFormatSymbols decimalSymbols = DecimalFormatSymbols.getInstance();
decimalSymbols.setDecimalSeparator('.');
return new DecimalFormat("0.00", decimalSymbols).format(num);
}