private static String transform(String constantNameString)
    {
        StringBuilder sb = new StringBuilder();
        String tokens[] = constantNameString.split("_");
        List<String> list = new ArrayList<String>();
        for (String token : tokens)
        {
            String t = token.trim();
            if (!t.isEmpty())
            {
                list.add(t);
            }
        }
        for (int i=0; i<list.size(); i++)
        {
            if (i > 0)
            {
                sb.append(" ");
            }
            String t = list.get(i);
            sb.append(Character.toUpperCase(t.charAt(0)));
            sb.append(t.substring(1).toLowerCase());
        }
        return sb.toString();
    }
private static String transform ( String constantNameString ) { StringBuilder sb = new StringBuilder ( ) ; String tokens [ ] = constantNameString . split ( "_" ) ; List < String > list = new ArrayList < String > ( ) ; for ( String token : tokens ) { String t = token . trim ( ) ; if ( ! t . isEmpty ( ) ) { list . add ( t ) ; } } for ( int i = 0 ; i < list . size ( ) ; i ++ ) { if ( i > 0 ) { sb . append ( " " ) ; } String t = list . get ( i ) ; sb . append ( Character . toUpperCase ( t . charAt ( 0 ) ) ) ; sb . append ( t . substring ( 1 ) . toLowerCase ( ) ) ; } return sb . toString ( ) ; }
Transform the given constant name, which is assumed to be in the
form <code>"SOME_CONSTANT_NAME"</code>, into a string that has
the form <code>"Some Constant Name"</code>.

@param constantNameString The constant name
@return The transformed name