Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Actuate Corporation - initial API and implementation *******************************************************************************/ import java.util.Stack; public class Main { public static String getColumnId(int column) { Stack<Character> digits = new Stack<Character>(); int dividant = column; while (dividant > 26) { int remain = dividant % 26; dividant = dividant / 26; if (remain == 0) { remain = 26; dividant--; } digits.push((char) ('A' + remain - 1)); } digits.push((char) ('A' + dividant - 1)); StringBuffer buffer = new StringBuffer(); while (!digits.empty()) { buffer.append(digits.pop()); } String columnId = buffer.toString(); return columnId; } }