List of utility methods to do Number Format Pattern
DecimalFormat | getFormatter(String pattern) Create a DecimalFormat instance for the given pattern that uses '.' DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator('.'); return new DecimalFormat(pattern, symbols); |
float | getFormatTwoPoint(float param) get Format Two Point param += 0.001; java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00"); return Float.parseFloat(df.format(param)); |
DecimalFormat | getFormatWithMinimumDecimals(final int minimumDecimals, final int maximumDecimals) Get a decimal format with a specific number of minimum and maximum decimals. if (maximumDecimals < 0) { throw new IllegalArgumentException("Negative maximum decimals are invalid."); } else if (minimumDecimals < 0) { throw new IllegalArgumentException("Negative minimum decimals are invalid."); } else if (minimumDecimals > maximumDecimals) { throw new IllegalArgumentException("The minimum decimals have to be lower than the maximum decimals."); } else if (minimumDecimals == 0 && maximumDecimals == 0) { return new DecimalFormat("#0"); ... |
NumberFormat | getGeographicPositionFormatter() Returns the number formatter for the geographical position feature. return GEO_NUM_FORMATTER;
|
NumberFormat | getIntegerFormat() get Integer Format if (intFmt == null) { intFmt = NumberFormat.getIntegerInstance(); intFmt.setGroupingUsed(true); return intFmt; |
DecimalFormat | getIntegerFormat(int maximumIntegerDigits) get Integer Format DecimalFormat decimalEditFormat = new DecimalFormat(); decimalEditFormat.setMaximumFractionDigits(0); decimalEditFormat.setGroupingUsed(false); decimalEditFormat.setParseIntegerOnly(true); if (maximumIntegerDigits > 0) { decimalEditFormat.setMaximumIntegerDigits(maximumIntegerDigits); decimalEditFormat.setMinimumIntegerDigits(maximumIntegerDigits); return decimalEditFormat; |
NumberFormat | getIntegerFormatter() get Integer Formatter return DecimalFormat.getIntegerInstance();
|
NumberFormat | getIntegerNumberFormat() get Integer Number Format NumberFormat nf = NumberFormat.getIntegerInstance();
nf.setGroupingUsed(false);
return nf;
|
NumberFormat | getNeptusIntegerFormat() get Neptus Integer Format NumberFormat df = DecimalFormat.getInstance(Locale.US);
df.setGroupingUsed(false);
df.setMaximumFractionDigits(0);
df.setMinimumFractionDigits(0);
df.setParseIntegerOnly(true);
return df;
|
Number | getNumber(final Map map, final Object key) Gets a Number from a Map in a null-safe manner. if (map != null) { Object answer = map.get(key); if (answer != null) { if (answer instanceof Number) { return (Number) answer; } else if (answer instanceof String) { try { String text = (String) answer; ... |