Java Utililty Methods Fraction Format

List of utility methods to do Fraction Format

Description

The list of methods to do Fraction Format are organized into topic(s).

Method

Stringformat(double d)
format
return formatter.format(d);
Stringformat(double d)
decides format for all doubles displayed and uses nice formatting if value is greater than 1e-03.
if (Math.abs(d) > 0.001) {
    return getValueFormatter().format(d);
} else {
    return "" + d;
Stringformat(double d, DecimalFormat unitFormatter)
format
final double rounded = roundDoubleToDecimals(d, unitFormatter.getMaximumFractionDigits());
return unitFormatter.format(rounded);
Stringformat(Double d, int digit)
Formats a double to string.
if (d == null) {
    return "";
StringBuffer sb = new StringBuffer();
sb.append("#");
for (int i = 0; i < digit; i++) {
    if (i == 0) {
        sb.append(".");
...
Stringformat(double d, java.text.NumberFormat format)
format
synchronized (format) {
    return format.format(d);
Stringformat(double degrees)
Remove decimal point from value and return its string representation
double dVal = degrees;
DecimalFormat form = new DecimalFormat("###0.000000"); 
return form.format(dVal);
Stringformat(double input, String format)
Formats a number in a specified pattern.
DecimalFormat decimalFormat = new DecimalFormat(format);
return decimalFormat.format(input);
Stringformat(double n)
Formats the given number into a price.
NumberFormat formatter;
String number;
formatter = new DecimalFormat("#,###,###,###.00");
number = formatter.format(n);
if (currency.length() == 1) {
    return currency + number;
} else {
    return number + " " + currency;
...
Stringformat(double no, String formatter)
Formats a number to the specific formatter stirng.
DecimalFormat df = new DecimalFormat(formatter);
return df.format(no);
Stringformat(double num)
format
return new DecimalFormat(",###").format(num);