Here you can find the source of moneyFenToYuan(String amount)
public static String moneyFenToYuan(String amount)
//package com.java2s; public class Main { public static String moneyFenToYuan(String amount) { if (isEmpty(amount)) { return amount; }//from w w w . ja v a 2 s.c o m if (amount.indexOf(".") > -1) { return amount; } if (amount.length() == 1) { return "0.0" + amount; } else if (amount.length() == 2) { return "0." + amount; } else { return amount.substring(0, amount.length() - 2) + "." + amount.substring(amount.length() - 2); } } public static boolean isEmpty(String input) { return null == input || 0 == input.length() || 0 == input.replaceAll("\\s", "").length(); } public static boolean isEmpty(byte[] bytes) { return null == bytes || 0 == bytes.length; } }