Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
    1 -> A
    2 -> B
    3 -> C
    ...
    26 -> Z
    27 -> AA
    28 -> AB 
1 public class Solution { 2 public String convertToTitle(int n) { 3 String ret=""; 4 5 while (n>0) { 6 n--; 7 char letter=(char) (n%26+‘A‘); 8 ret=letter+ret; 9 n=n/26; 10 } 11 12 return ret; 13 14 } 15 }
LeetCode Excel Sheet Column Title
原文:http://www.cnblogs.com/birdhack/p/4178969.html