List of utility methods to do Fraction Format
String | formatDoubleArray(double[] arr, String format) format Double Array DecimalFormat fmt = new DecimalFormat(format); StringBuilder sb = new StringBuilder(); sb.append("["); for (int i = 0; i < arr.length; i++) { if (i > 0) { sb.append(", "); sb.append(fmt.format(arr[i])); ... |
String | formatDoubleAsPointsString(Double d) format Double As Points String if (d == null) return ""; return NumberFormat.getInstance().format(d); |
String | formatDoubleAsString(Double val) format Double As String return formatDoubleAsString(val, 2); |
String | formatDoubleDecimal(float in) format Double Decimal DecimalFormat df = new DecimalFormat(); df.applyPattern("0.00"); return df.format(in); |
double | formatDoubleDecPoint2(Double value) format Double Dec Point try { java.text.DecimalFormat form = new java.text.DecimalFormat("##.00"); String s = form.format(value); return Double.valueOf(s); } catch (Exception e) { return 0.0; |
String | formatDoubleList(List format Double List return formatDoubleList(list, decimalFormat);
|
String | formatDoubleString(double data, String pattern) format Double String DecimalFormat format = new DecimalFormat(pattern); if (data < 0) { return "0"; if ((int) (data * 10) == (int) (data) * 10) { return (int) data + ""; } else { return format.format(data); ... |
Double | formatDoubleValue(String originalVal, Double valToProcess) Converts a double value to contain decimal places in the frequency the original value was recorded. StringBuffer format = new StringBuffer("#"); int numDecimals; int numKeyVals = originalVal.length(); if (originalVal.contains(".")) { format.append("."); numDecimals = originalVal.substring(originalVal.lastIndexOf(".") + 1).trim().length(); for (int i = 0; i < numDecimals; i++) { format.append("#"); ... |
String | formateNum(double num) formate Num NumberFormat f = NumberFormat.getInstance();
f.setMaximumFractionDigits(4);
return f.format(num);
|
float | formatFloat(double val1, double val2) format Float return val2 == 0 ? 0 : Float.parseFloat(floatFormatter.format(val1 / val2)); |