Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String formatDouble(double d) { DecimalFormat formatter = new DecimalFormat("#,###.##"); d = Math.round(d); return formatter.format(d); } }