List of utility methods to do Fraction Format
String | formatFloat(float f, String format) format Float DecimalFormat df = new DecimalFormat(format); return df.format(f); |
float | formatFloat(float num) format Float float q = 0f; try { DecimalFormat df = new DecimalFormat("#.###"); q = Float.parseFloat(df.format(num).replace(",", ".")); } catch (Exception e) { e.printStackTrace(); return q; ... |
String | formatFloat(float number) format Float return floatFormat.format(number);
|
float | formatFloat(float number, int numberOfAfterDot) format Float String format = "."; for (int i = 0; i < numberOfAfterDot; i++) { format += "0"; DecimalFormat decimalFormat = new DecimalFormat(format); String tmp = decimalFormat.format(number); return Float.parseFloat(tmp); |
String | formatFloat(Float someFloat) Formats a float as a string with a default number of significant digits depending on the argument's value. return formatDouble(someFloat.doubleValue());
|
String | FormatFloat(float value, int point) Format Float NumberFormat numFormat = NumberFormat.getNumberInstance();
numFormat.setMaximumFractionDigits(point);
String str = numFormat.format(value);
return str;
|
String | formatFloat(String format, double f) format Float StringBuffer formatString = new StringBuffer(format); java.text.DecimalFormat df = new java.text.DecimalFormat(formatString.toString()); return df.format(f); |
String | formatFloatToStr(Float str) format Float To Str return formatFloatToStr(str, null);
|
Float | FormatFolat(Float num) Format Folat if (num == null) { return null; int p_num = num.toString().indexOf("."); if (((num.toString().length()) - p_num - 1) > 5) { if (Integer.parseInt(num.toString().substring(p_num + 6, p_num + 7)) >= 5) { num = num + new Float(0.000001); DecimalFormat df = new DecimalFormat("####.00000"); return new Float(df.format(num)); |
String | formatGetal(float getal) format Getal DecimalFormatSymbols dfs = new DecimalFormatSymbols(); dfs.setGroupingSeparator('.'); dfs.setDecimalSeparator(','); DecimalFormat decimalFormat = new DecimalFormat("0.##"); decimalFormat.setDecimalFormatSymbols(dfs); return decimalFormat.format(getal); |