All pastes #993751 Raw Edit

Mine

public text v1 · immutable
#993751 ·published 2008-04-22 20:45 UTC
rendered paste body
    public static String getAlpha(int num) {
        final int base = 26;
        String results = "";
        
        while (num > 0) {
            int quo = new Double(Math.floor(num / base)).intValue();
            results = (char)(num % base + 65) + results;
            num = quo;
        }
        if (results.length() == 1) {
            return results;
        }
        
        char[] res = results.toCharArray();
        res[0]--;
        return new String(res);
    }