String (String name) { int start; for (start = 0; start < name.length(); start++) { char c = name.charAt(start); if (Character.isJavaIdentifierStart(c) && c != '_' && c != '$') { break; } } StringBuilder className = new StringBuilder(); boolean skip = true; for (int i = start; i < name.length(); i++) { char c = name.charAt(i); if (!Character.isJavaIdentifierPart(c) || c == '_' || c == '$') { skip = true; continue; } if (skip) { skip = false; className.append(Character.toUpperCase(c)); } else { className.append(c); } } return className.toString(); }