public static String getClassName( final Class<?> clazz ) {
        final String fullName = clazz.getName();
        final int fullNameLength = fullName.length();

        // Check for array ('[') or the class/interface marker ('L') ...
        int numArrayDimensions = 0;
        while (numArrayDimensions < fullNameLength) {
            final char c = fullName.charAt(numArrayDimensions);
            if (c != '[') {
                String name = null;
                // Not an array, so it must be one of the other markers ...
                switch (c) {
                    case 'L': {
                        name = fullName.subSequence(numArrayDimensions + 1, fullNameLength).toString();
                        break;
                    }
                    case 'B': {
                        name = "byte";
                        break;
                    }
                    case 'C': {
                        name = "char";
                        break;
                    }
                    case 'D': {
                        name = "double";
                        break;
                    }
                    case 'F': {
                        name = "float";
                        break;
                    }
                    case 'I': {
                        name = "int";
                        break;
                    }
                    case 'J': {
                        name = "long";
                        break;
                    }
                    case 'S': {
                        name = "short";
                        break;
                    }
                    case 'Z': {
                        name = "boolean";
                        break;
                    }
                    case 'V': {
                        name = "void";
                        break;
                    }
                    default: {
                        name = fullName.subSequence(numArrayDimensions, fullNameLength).toString();
                    }
                }
                if (numArrayDimensions == 0) {
                    // No array markers, so just return the name ...
                    return name;
                }
                // Otherwise, add the array markers and the name ...
                if (numArrayDimensions < BRACKETS_PAIR.length) {
                    name = name + BRACKETS_PAIR[numArrayDimensions];
                } else {
                    for (int i = 0; i < numArrayDimensions; i++) {
                        name = name + BRACKETS_PAIR[1];
                    }
                }
                return name;
            }
            ++numArrayDimensions;
        }

        return fullName;
    }
public static String getClassName ( final Class < ? > clazz ) { final String fullName = clazz . getName ( ) ; final int fullNameLength = fullName . length ( ) ; int numArrayDimensions = 0 ; while ( numArrayDimensions < fullNameLength ) { final char c = fullName . charAt ( numArrayDimensions ) ; if ( c != '[' ) { String name = null ; switch ( c ) { case 'L' : { name = fullName . subSequence ( numArrayDimensions + 1 , fullNameLength ) . toString ( ) ; break ; } case 'B' : { name = "byte" ; break ; } case 'C' : { name = "char" ; break ; } case 'D' : { name = "double" ; break ; } case 'F' : { name = "float" ; break ; } case 'I' : { name = "int" ; break ; } case 'J' : { name = "long" ; break ; } case 'S' : { name = "short" ; break ; } case 'Z' : { name = "boolean" ; break ; } case 'V' : { name = "void" ; break ; } default : { name = fullName . subSequence ( numArrayDimensions , fullNameLength ) . toString ( ) ; } } if ( numArrayDimensions == 0 ) { return name ; } if ( numArrayDimensions < BRACKETS_PAIR . length ) { name = name + BRACKETS_PAIR [ numArrayDimensions ] ; } else { for ( int i = 0 ; i < numArrayDimensions ; i ++ ) { name = name + BRACKETS_PAIR [ 1 ] ; } } return name ; } ++ numArrayDimensions ; } return fullName ; }
Returns the name of the class. The result will be the fully-qualified class name, or the readable form for arrays and
primitive types.

@param clazz the class for which the class name is to be returned.
@return the readable name of the class.