List of usage examples for java.text DecimalFormat DecimalFormat
public DecimalFormat(String pattern)
From source file:Main.java
public static String getTwoDecimal(double db) { return new DecimalFormat("######0.00").format(db); }
From source file:Main.java
public static String string2Dec(double number) { return new DecimalFormat("#.##").format(number); }
From source file:Main.java
public static String toDecimalString(float value) { return new DecimalFormat("0.######").format(value); }
From source file:Main.java
public static double save2(Double ori) { DecimalFormat df = new DecimalFormat("#0.00"); String x = df.format(ori);/* ww w .j ava 2s .c o m*/ return Double.valueOf(x); }
From source file:Main.java
public static String DouToStr2(double dd) { DecimalFormat df = new DecimalFormat("#.##"); return df.format(dd); }
From source file:Main.java
public static String format1(double input) { DecimalFormat df = new DecimalFormat("#.#"); return df.format(input); }
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 double getFormatted(double d) { DecimalFormat df = new DecimalFormat("#.000000000000000"); String s = df.format(d);/*w w w .j a va2s . c om*/ double d2 = Double.parseDouble(s); return d2; }
From source file:Main.java
public static double roundOff(double amount) { return Double.valueOf(new DecimalFormat("0.00").format(amount)); }
From source file:Main.java
public static String getString(double value) { DecimalFormat df = new DecimalFormat("#####0"); String target = df.format(value); return target; }