List of usage examples for java.text DecimalFormat format
public final String format(double number)
From source file:Main.java
public static String formatCurrency(double d) { DecimalFormat formatter = new DecimalFormat("'$'#,##0.00"); return formatter.format(d); }
From source file:Main.java
public static String setInt(String me) { Double tmp = Double.parseDouble(me); DecimalFormat df = new DecimalFormat("#0.00"); String label = df.format(tmp).toString(); return label; }
From source file:Main.java
public static double format2(double input) { DecimalFormat df = new DecimalFormat("#.00"); return Double.valueOf(df.format(input)); }
From source file:Main.java
public static String formatString(double text) { DecimalFormat df = new DecimalFormat("0.##"); String str = df.format(text); return str;/* www .j a v a2 s . c o m*/ }
From source file:Main.java
public static String formatString(Object text) { DecimalFormat df = new DecimalFormat("0.##"); String str = df.format(text); return str;/* w ww.j a v a 2s .c om*/ }
From source file:Main.java
public static String doubleToString(double num) { DecimalFormat df = new DecimalFormat("0.00"); return df.format(num); }
From source file:Main.java
public static String get6Double(String a) { double d = Double.parseDouble(a); DecimalFormat df = new DecimalFormat("0.000000"); return new String(df.format(d).toString()); }
From source file:Main.java
public static String formatFloat2Point(float num) { String f1 = ""; try {//from ww w .ja v a 2s .c o m DecimalFormat fnum = new DecimalFormat("0.00"); f1 = fnum.format(num); } catch (Exception e) { e.printStackTrace(); } return f1; }
From source file:Main.java
/** * //from ww w. j a v a 2 s. c om * @param number * @return */ public static String getDecimalNumber(long number, float divider) { DecimalFormat format = new DecimalFormat("#0.0"); return format.format(number / divider); }
From source file:Main.java
public static String removeZero(double d) { DecimalFormat format = new DecimalFormat("0.#"); return format.format(d); }