pStr="0"+tempStr; } countArr++; resZheng=zheng2Han(countArr,tempStr)+" "+resZheng; }else{ if(countNum==4){ countArr++; resZheng=zheng2Han(countArr,tempStr)+" "+resZheng; countNum=0; tempStr=""; } } } //去掉开头的零 if(resZheng.charAt(0)=='零'){ resZheng=resZheng.substring(1,resZheng.length()); } /*整数和小数的连接*/ //表示整数部分为0 if(resZheng.charAt(0)=='元'){ resZheng="零"+resZheng; } result=resZheng+resXiao; return result; } /** * 每个4位的整数组转化为大写的数字 * @param count 记录是第几个数组(1-3) * @param str 需要被转换的数组 * @return 返回该数组人民币读法 */ private String zheng2Han(int count,String str){ String result=""; for(int j=0;j<4;j++){ int tempNum=str.charAt(j)-48; if(tempNum!=0){ if(j!=3){ result+=hanArr[tempNum]+unitArr[j]; }else{ result+=hanArr[tempNum]; } }else{ if((j-1<0)||(str.charAt(j-1)-48!=0)){ result+=hanArr[tempNum]; } } & |