AlphaNumericCodec implements Codec { @Override public int decode(String s) { int i = 0; char[] chars = s.toCharArray(); for(char c : chars) { i = i * ALPHABET_LENGTH + ALPHABET.indexOf(c); } return i; }  String encode(int number); @Override int decode(String s);  }
@Test public void e9aDecode() { int i = alphaNumericCodec.decode("e9a"); assertEquals(19158, i); }
@Test public void testDecodeTwoUpperCaseProgression() { assertEquals(62, alphaNumericCodec.decode("ba")); assertEquals(63, alphaNumericCodec.decode("bb")); assertEquals(64, alphaNumericCodec.decode("bc")); assertEquals(123, alphaNumericCodec.decode("b9")); assertEquals(124, alphaNumericCodec.decode("ca")); assertEquals(185, alphaNumericCodec.decode("c9")); }
@Test public void cbDecode() { int i = alphaNumericCodec.decode("cb"); assertEquals(125, i); }