Java tutorial
//package com.java2s; //License from project: Apache License import java.text.NumberFormat; import java.util.Locale; public class Main { public static String formatMoneyAmount(double amount, Locale locale) { NumberFormat format = NumberFormat.getCurrencyInstance(locale); String amountTxt = format.format(amount); String amountTxtValue = ""; for (int i = 0; i < amountTxt.length(); i++) { if (Character.isDigit(amountTxt.charAt(i)) || amountTxt.charAt(i) == '.' || amountTxt.charAt(i) == ',') amountTxtValue = amountTxtValue + amountTxt.charAt(i); } amountTxt = amountTxtValue; if (amountTxt.endsWith(",00")) return (amountTxt.replace(",00", "")); return (amountTxt); } }