Java tutorial
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { private static final String FORMAT_NO_DECIMAL = "###,###"; public static String formatToStringWithoutDecimal(double value) { NumberFormat formatter = new DecimalFormat(FORMAT_NO_DECIMAL); return formatter.format(value); } public static String formatToStringWithoutDecimal(String value) { return formatToStringWithoutDecimal(Double.parseDouble(value)); } }