package data; public class NumCover{ private String[] numArry = {"零", "壹","贰","叁","肆","伍","陆","柒","捌","玖"}; private String[] unitArry = {"拾", "佰","仟","万","十万","百万","千万","亿","十亿","百亿","千亿"}; public String[] div(double num){ long zheng = (long)num; long xiao = Math.round((num - zheng) * 100); return new String[]{String.valueOf(zheng),String.valueOf(xiao)}; } public String cover(String numStr){ String result = ""; int len = numStr.length(); for(int i = 0;i<len; i++){ int num = numStr.charAt(len-1-i)-48; int prenum = 0; boolean b = false; if(i != len-1){ prenum = numStr.charAt(len-2-i)-48; } if(i!= 0 && num != 0){ result = numArry[num] + unitArry[i-1] +result; b = true; } else if((prenum != 0 && b) || ((i == 0) && (num !=0))) { result = numArry[num] + result; } } return result; } }