Java tutorial
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import java.text.DecimalFormat; public class Main { public static String formatToYuanYXS(String money) { DecimalFormat df = new DecimalFormat("#0.0"); return df.format(formatToYuan(money)); } public static BigDecimal formatToYuan(String money) throws NumberFormatException { if (money.equals("")) { return new BigDecimal(0); } long m = Long.parseLong(money); return BigDecimal.valueOf(m); } }