In pure Java, I would normally have a function like the one below for limiting the number of decimal places to decimalCount
for a given number value
. However, according to the GWT docs, "GWT does not provide full emulation for the date and number formatting classes (such as java.text.DateFormat, java.text.DecimalFormat, java.text.NumberFormat, and java.TimeFormat)." What would one do to the following function in order to make it work in GWT?
public static String getFormatted(double value, int decimalCount) {
DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(decimalCount);
return decimalFormat.format(value);
}