List of usage examples for java.text DecimalFormat format
public final String format(double number)
From source file:Main.java
public static String getDecimal(String str) { double d = Double.valueOf(str); DecimalFormat df = new DecimalFormat("0.00"); return df.format(d); }
From source file:Main.java
public static String fileByte2Kb(double size) { double mbSize = size / 1024; DecimalFormat df = new DecimalFormat("#.##"); return df.format(mbSize); }
From source file:Main.java
public static String getStringFromFloat(float price, String format) { DecimalFormat df = new DecimalFormat("#0.00"); return df.format(price); }
From source file:Main.java
public static String getDiscount(double num) { double per = num / 10.00; DecimalFormat dft = new DecimalFormat("0.##"); return dft.format(per); }
From source file:Main.java
public static String getYuan(double fen) { double yuan = fen / 100.00; DecimalFormat dft = new DecimalFormat("0.00"); return dft.format(yuan); }
From source file:Main.java
public static String formatDouble(double dblValue) { DecimalFormat df = new DecimalFormat("####.00"); return df.format(dblValue); }
From source file:Main.java
public static double save2(Double ori) { DecimalFormat df = new DecimalFormat("#0.00"); String x = df.format(ori); return Double.valueOf(x); }
From source file:Main.java
public static float changToTwoDecimal(float in) { DecimalFormat df = new DecimalFormat("0.00"); String out = df.format(in); return Float.parseFloat(out); }
From source file:Main.java
public static String AmountShow(double sum) { DecimalFormat df1 = new DecimalFormat("#,###,##0.00"); return df1.format(sum); }
From source file:Main.java
public static String formatDecimal(float value) { DecimalFormat df = new DecimalFormat("#.##"); return df.format(value); }