Here you can find the source of formatNumberUk(double inNumber, int inDecimalPlaces)
Parameter | Description |
---|---|
inNumber | double number to format |
inDecimalPlaces | number of decimal places |
public static String formatNumberUk(double inNumber, int inDecimalPlaces)
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; import java.util.Locale; public class Main { /** UK-specific number formatter object to avoid lots of instantiations */ private static final NumberFormat UK_FORMAT = NumberFormat.getNumberInstance(Locale.UK); /**//from www .j ava2s . c o m * Format the given number in UK format (decimal point) to the given number of decimal places * @param inNumber double number to format * @param inDecimalPlaces number of decimal places */ public static String formatNumberUk(double inNumber, int inDecimalPlaces) { UK_FORMAT.setMaximumFractionDigits(inDecimalPlaces); UK_FORMAT.setMinimumFractionDigits(inDecimalPlaces); return UK_FORMAT.format(inNumber); } }