AutoPageNumberUtils { public static String asAlphaNumeric(int i) { StringBuffer sbuff = new StringBuffer(); int index = i % MAX; int ratio = i / MAX; if (index == 0) { ratio--; index = MAX; } for(int j = 0; j <= ratio; j++) { sbuff.append(ALPHABET[index - 1]); } return sbuff.toString(); }  static String asAlphaNumeric(int i); static String asAlphaNumericLower(int i); static String asRomanNumerals(int i); static String asRomanNumeralsLower(int i);  }
@Test public void testAlphaUpper() { assertEquals("A", AutoPageNumberUtils.asAlphaNumeric(1)); assertEquals("Z", AutoPageNumberUtils.asAlphaNumeric(26)); assertEquals("AA", AutoPageNumberUtils.asAlphaNumeric(27)); assertEquals("ZZ", AutoPageNumberUtils.asAlphaNumeric(52)); assertEquals("AAA", AutoPageNumberUtils.asAlphaNumeric(53)); assertEquals("ZZZ", AutoPageNumberUtils.asAlphaNumeric(78)); }