Java Integer to intToColumnName(int column)

Here you can find the source of intToColumnName(int column)

Description

int To Column Name

License

Open Source License

Declaration

public static String intToColumnName(int column) 

Method Source Code

//package com.java2s;

public class Main {
    public static String intToColumnName(int column) {
        // log.debug("intToColumnName("+column+")");
        StringBuffer s = new StringBuffer();

        column++;/*from w  ww .j av a  2s  .  c  o m*/

        while (column > 26) {
            int c = column % 26;
            column = column / 26;

            if (c == 0) {
                s.insert(0, 'Z');
                column--;
            } else {
                s.insert(0, (char) (c + 'A' - 1));
            }
        }
        s.insert(0, (char) (column + 'A' - 1));

        // log.debug("    " + s + "  =>  " + columnNameToInt(s.toString()));
        return s.toString();
    }
}

Related

  1. IntToBuf2BE(int val, byte[] buf, int offset)
  2. intToBuffer(int i, byte[] ioBuffer)
  3. intToCodeString(int value)
  4. intToColour(int colour)
  5. intToCols(int i)
  6. intToDateString(int i)
  7. intToDay(int d)
  8. intToDegree(int storedInt)
  9. intToDigits(int n)