Here you can find the source of str2money(String str)
public static String str2money(String str)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { public static String str2money(String str) { try {/*from w w w .ja va 2 s . c o m*/ double amt = Long.parseLong(str) / 100.0D; return formatMoney(amt); } catch (Exception e) { System.err.println(e); } return str; } public static String formatMoney(double d) { DecimalFormat format = (DecimalFormat) NumberFormat.getPercentInstance(); format.applyPattern("###########0.00"); return format.format(d); } public static String formatMoney(String money) { if (money == null) return ""; try { money = money.trim(); double d = Double.parseDouble(money); return formatMoney(d); } catch (Exception e) { System.err.println(e); } return money; } }