public static boolean isValidJavaIdentifier ( String s ) { if ( s == null || s . length ( ) == 0 ) { return false ; } if ( isJavaKeyword ( s ) ) { return false ; } char [ ] c = s . toCharArray ( ) ; if ( ! Character . isJavaIdentifierStart ( c [ 0 ] ) ) { return false ; } for ( int i = 1 ; i < c . length ; i ++ ) { if ( ! Character . isJavaIdentifierPart ( c [ i ] ) ) { return false ; } } return true ; }
Checks whether the given String is a valid Java identifier .