public static int numOfIntToString(int number)
{
if (number < 0)
{
return -1;
}
if (number > 0 && number <= 9)
{
return 1;
}
// 转换成相应的字符串
String strNum = number + "";
int end = strNum.length() - 1;
int[] count = new int[strNum.length()];
for (int i = end; i >= 0; i--)
{
count[i] = numOfIntToStringCor(strNum, i, end, count);
}
return count[0];
}
public static int numOfIntToStringCor(String strNum, int begin, int end,
int[] count)
{
int res = 0;
if (begin == end)
{
return 1;
}
if (end >= strNum.length())
{
return -1;
}
Integer temp = new Integer(strNum.substring(begin, begin + 2));
if (temp >= 10 && temp <= 25)
{
if (begin + 2 <= end)
{
return count[begin + 1] + count[begin + 2];
}
}
res = count[begin + 1];
return res;
}