code: public static boolean isJavaIdentifier( String str ) {
        if( str.length() == 0 || !Character.isJavaIdentifierStart( str.charAt( 0 ) ) ){
           return false;
        }
        for( int i = 1; i < str.length(); i++ ){
           if( !Character.isJavaIdentifierPart( str.charAt( i ) ) ){
              return false;
           }
        }
        return true;
     }
docs: Returns trus if str represents a valid Java identifier.