List of utility methods to do Fraction Format
String | formatNumber(String Format, double Num) Formats a number using DecimalFormat . if (nf instanceof DecimalFormat) ((DecimalFormat) nf).applyPattern(Format); return nf.format(Num); |
String | formatNumber(String format, double number) Converts the number into the specified format if (format == null) return "" + number; DecimalFormat df = new DecimalFormat(format); String retVal = null; try { retVal = df.format(number); } catch (Exception e) { retVal = "" + number; ... |
String | formatNumber(String number, int maxFractionalDigits) Formats the provided number with the specified number of fractional digits If number arg is not a number, returns the String try { NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(maxFractionalDigits); return nf.format(Double.parseDouble(number)); } catch (Exception ex) { return number; |
String | formatNumberAttribute(double v) format Number Attribute return format.format((float) v); |
String | formatNumFraction(float num, int unit) format Num Fraction String zero = ""; if (unit == 0) { zero = "0"; } else { zero = "0."; for (int i = 0; i < unit; i++) { zero += "0"; ... |
double | formatNumValueWithComma(double val) format Num Value With Comma double formattedValue; DecimalFormat formatter = new DecimalFormat("#,###,##0.00"); String newValue = formatter.format(val); formattedValue = Double.parseDouble(newValue); return formattedValue; |
String | formatoDecimal(String tipo, double valor) formato Decimal String mascara = "0."; if (tipo.equals("Q")) { for (int i = 0; i < DECIMAL_QUANTIDADE; i++) { mascara += "0"; } else if (tipo.equals("V")) { for (int i = 0; i < DECIMAL_VALOR; i++) { mascara += "0"; ... |
String | formatOLETime(double oleTime) format OLE Time long dateTime = getMillisFromOLEDate(oleTime); return formatDateTime(dateTime); |
String | formatOneDecimal(double dNumber) format One Decimal return ONEDP.format(dNumber);
|
String | formatOneDp(double inNumber) format One Dp return FORMAT_ONE_DP.format(inNumber);
|