public classtoChinese { public toChinese() { } public static String ConvetC(BigDecimal bds) { String strZero = 零; String strYuan = 圆; String strJiao = 角; String strFen = 分; String strZheng = 整; String strItem[] = { 万 亿 兆 ?? !! **};//万 String strC[]={ 壹 贰 三 肆 伍 陆 柒 捌 玖 拾}; String strB[]={ 拾 佰 仟}; String strChinese = new String(); String strSource = bdstoString(); String[] strDesk; String strPrec = new String(); int i = j = iNumber = iPrec = iItem = iLoc = ; iNumber = strSourceindexOf(); strPrec = strSourcesubstring(iNumber+); //Systemoutprintln(strPrec); iPrec = strSourcelength() iNumber ; iItem = (int)((iNumber+)/); strDesk = new String[iItem]; //Systemoutprintln( iNumber = + iNumber + iPrec = + iPrec + iItem = + iItem); for(i=; i<iItem; i++) { iLoc = (iNumber * i) > ? : (iNumber * i); //Systemoutprintln( iNumber = + iNumber + iPrec = + iPrec + iItem = + iItem + iLoc = + iLoc); strDesk[i] = ; int iNowItem[] = { }; for(j= (i*)+iLoc; j> (i*) ; j) { iNowItem[ji*] = (int)(strSourcecharAt(iNumber j )); //Systemoutprintln(ji* + +strSourcecharAt(iNumber j ) + + j); } strDesk[i] = strItem[i]; //Systemoutprintln(strDesk[i]); if(iNowItem[]>) { strDesk[i] =strC[iNowItem[]] + strB[] + strDesk[i]; } if(iNowItem[]>) { strDesk[i] =strC[iNowItem[]] + strB[] + strDesk[i]; } else if(iNowItem[]== && iNowItem[]> ) { strDesk[i] =strZero + strDesk[i]; } if(iNowItem[]>) { strDesk[i] =strC[iNowItem[]] + strB[] + strDesk[i]; } else if(iNowItem[]== &&iNowItem[]> ) { strDesk[i] =strZero + strDesk[i]; } if(iNowItem[]>) { strDesk[i] =strC[iNowItem[]] + strB[] + strDesk[i]; } else if(iNowItem[]== && iNowItem[]> ) { strDesk[i] =strZero + strDesk[i]; } if(iNowItem[]==&&iNowItem[]==&&iNowItem[]==&&iNowItem[]==) { strDesk[i] = strZero; if(i==) { strDesk[i] = ; } else if (strDesk[i]equals() || strDesk[i]indexOf(strZero)==) { strDesk[i] = ; } } strChinese = strDesk[i] + strChinese ; } strChinese = strChinese + strYuan; int iJiao= iFen=; try { iJiao = (int)(strPreccharAt()); } catch(Exception e) { } try { iFen = (int)(strPreccharAt()); } catch(Exception e) { } if(iJiao>) { strChinese = strChinese + strC[iJiao] + strJiao ; } if(iFen>) { strChinese = strChinese + strC[iFen] + strFen ; } else strChinese = strChinese + strZheng ; //Systemoutprintln(strChinese); return(strChinese); } public static void main(String[] args) { BigDecimal bdtest = new BigDecimal(); Systemoutprintln(toChineseConvetC(bdtest)); } } |