private boolean isLegalClassName(String className){
  int lastBracket=className.lastIndexOf("]");
  if (lastBracket != -1 && lastBracket != className.length() - 1) {
    return false;
  }
  className=className.replaceAll("\\[\\]","");
  String[] identifiers=className.split("(\\.)");
  for (  String identifier : identifiers) {
    if (!isJavaIdentifier(identifier)) {
      return false;
    }
  }
  return true;
}

private boolean isLegalClassName ( String className ) { int lastBracket = className . lastIndexOf ( "]" ) ; if ( lastBracket != - 1 && lastBracket != className . length ( ) - 1 ) { return false ; } className = className . replaceAll ( "\\[\\]" , "" ) ; String [ ] identifiers = className . split ( "(\\.)" ) ; for ( String identifier : identifiers ) { if ( ! isJavaIdentifier ( identifier ) ) { return false ; } } return true ; }
a string is a legal binary name if it has the following form : ( ( java identifier ) \ . ) * ( java identifier ) ( [ ] ) https : / / docs . oracle . com / javase / specs / jls / se8 / html / jls - 13 . html # jls - 13 . 1
