05 August 2008
把数字转化为Excel中的字母
1
2
3
4
5
6
7
8
9
10
11
12
13
class Solution {
public String convertToTitle(int n) {
StringBuilder result = new StringBuilder();
while(n > 0){
n--;
result.insert(0, (char)('A' + n % 26));
n /= 26;
}
return result.toString();
}
}