I am trying to format prices using DecimalFormat, but this isn\'t working for all variations.
DecimalFormat df = new DecimalFormat(\"0.##\") df.format(7.8) d
I don't think it's possible, at least not with Java SE formatters. You need to make a custom formatter. I would do it like this
String res = df.format(number).replace(".00", "");