How to change the decimal separator of DecimalFormat from comma to dot/point?

I have this little crazy method that converts BigDecimal values into nice and readable Strings.

private String formatBigDecimal(BigDecimal bd){
    DecimalFormat df = new DecimalFormat();
    df.setMinimumFractionDigits(3);
    df.setMaximumFractionDigits(3);
    df.setMinimumIntegerDigits(1);
    df.setMaximumIntegerDigits(3);
    df.setGroupingSize(20);
    return df.format(bd);
}

It however, also produces a so called grouping separator "," that makes all my values come out like this:

xxx,xxx

I do need the separator to be a dot or a point and not a comma.
Does anybody have a clue of how to accomplish this little feat?

I have read this and in particular this to death now but I cannot find a way to get this done.
Am I approaching this the wrong way? Is there a much more elegant way of doing this? Maybe even a solution that accounts for different local number representations, since the comma would be perfect by European standards.

8 Answers
8

Leave a Comment