Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; import java.util.Locale; public class Main { public static String setLocaleNumberFormat(Locale locale, Number number) { NumberFormat formatter = NumberFormat.getInstance(locale); formatter.setMaximumFractionDigits(4); String localeFormattedNumber = formatter.format(number); return localeFormattedNumber; } }