double PV = 154055.054847215
How can I display this as 1,540,055.055 ?
double PV = 154055.054847215
How can I display this as 1,540,055.055 ?
add this instance of DecimalFormat to the top of your method:
DecimalFormat three = new DecimalFormat("#,##0.000"); // will display numbers separated by commas every three digits to the left of the decimal, and will round it to three decimal places. No more, no less.
// the three zeros after the decimal point above specify how many decimal places to be accurate to.
// the zero to the left of the decimal place above makes it so that numbers that start with "0." will display "0." vs just "." If you don't want the "0.", replace that 0 to the left of the decimal point with "#"
then, call the instance "three" and pass your double value when displaying:
double PV = 154055.054847215;
display.setText(three.format(PV)); // displays 1,540,055.055
String s = String.format(%,.2f, PV);
System.out.println(s);