public static int columnLabelToColumnIndex(String label)
    {
        requireNonNull(emptyToNull(label), "label is null or empty");

        int length = label.length();

        // Fast path
        if (length == 1) {
            char c = label.charAt(0);
            return charToIndex(c);
        }
        else if (length == 2) {
            char a = label.charAt(0);
            char b = label.charAt(1);
            return charToIndex(a) * RADIX + charToIndex(b) + RADIX;
        }

        // Slow path
        int value = 0;
        int power = 1;
        int offset = -1;
        for (int i = length - 1; i >= 0; i--) {
            value = addExact(value, multiplyExact(charToIndex(label.charAt(i)), power));
            offset = addExact(offset, power);
            power = multiplyExact(power, RADIX);
        }
        return value + offset;
    }
@Test
    public void testColumnLabelToColumnIndex()
    {
        assertEquals(columnLabelToColumnIndex("A"), 0);
        assertEquals(columnLabelToColumnIndex("B"), 1);
        assertEquals(columnLabelToColumnIndex("Z"), RADIX - 1);
        assertEquals(columnLabelToColumnIndex("AA"), RADIX);
        assertEquals(columnLabelToColumnIndex("AB"), RADIX + 1);
        assertEquals(columnLabelToColumnIndex("AZ"), RADIX + RADIX - 1);
        assertEquals(columnLabelToColumnIndex("BA"), RADIX + RADIX);
        assertEquals(columnLabelToColumnIndex("ZZ"), RADIX + RADIX * RADIX - 1);
        assertEquals(columnLabelToColumnIndex("AAA"), RADIX + RADIX * RADIX);
        assertEquals(columnLabelToColumnIndex("AAB"), RADIX + RADIX * RADIX + 1);
        assertEquals(columnLabelToColumnIndex("ZZZ"), RADIX + RADIX * RADIX + RADIX * RADIX * RADIX - 1);
        assertEquals(columnLabelToColumnIndex("AAAA"), RADIX + RADIX * RADIX + RADIX * RADIX * RADIX);
        assertEquals(columnLabelToColumnIndex("AAAB"), RADIX + RADIX * RADIX + RADIX * RADIX * RADIX + 1);
    }