2

I'm trying to display a Double to two decimal places (like 0.00). I don't want to use system.out.print as the value must appear in a textArea. I am currently getting

£ 2.5

instead of

£ 2.50

My code looks sort of like this:

DecimalFormat myDecimalFormat = new DecimalFormat("#.00");
String text = myDecimalFormat.format(total);
Anthony Mastrean
  • 21,032
  • 20
  • 99
  • 180
MichaelG
  • 61
  • 7

0 Answers0