class Debug {

    public static String abbreviatedName(Class<?> c) {
        if (c == null) {
            return null;
        }
        StringBuilder result = new StringBuilder();
        String fqcn = c.getName();
        int lastDot = -1;
        int thisDot = -1;
        while ((thisDot = fqcn.indexOf('.',
                                       thisDot + 1)) != -1) {
            result.append(fqcn.charAt(lastDot + 1));
            lastDot = thisDot;
        }
        if (lastDot != -1) {
            result.append('.');
        }
        result.append(fqcn.substring(lastDot + 1));
        return result.toString();
    }

}