public static String replaceIfIllegalJavaIdentifierCharacter(final String word) {
        requireNonNull(word);
        if (word.isEmpty()) {
            return REPLACEMENT_CHARACTER.toString(); // No name is translated to REPLACEMENT_CHARACTER only
        }
        final StringBuilder sb = new StringBuilder();
        for (int i = 0; i < word.length(); i++) {
            char c = word.charAt(i);
            if (i == 0) {
                if (Character.isJavaIdentifierStart(c)) {
                    // Fine! Just add the first character
                    sb.append(c);
                } else if (Character.isJavaIdentifierPart(c)) {
                    // Not ok as the first, but ok otherwise. Add the replacement before it
                    sb.append(REPLACEMENT_CHARACTER).append(c);
                } else {
                    // Cannot be used as a java identifier. Replace it
                    sb.append(REPLACEMENT_CHARACTER);
                }
            } else if (Character.isJavaIdentifierPart(c)) {
                // Fine! Just add it
                sb.append(c);
            } else {
                // Cannot be used as a java identifier. Replace it
                sb.append(REPLACEMENT_CHARACTER);
            }

        }
        return sb.toString();
        /*
           We need to replace regardless of case because we do not know how the return string is to be used
           if (JAVA_USED_WORDS_LOWER_CASE.contains(word.toLowerCase())) {
           If it is a java reserved/literal/class, add a "_" at the end to avoid naming conflicts
              return word + "_";
          }
          return word; */
    }
Turns the specified string into an underscore-separated string.

@param javaName  the string to parse
@return          as underscore separated
common-parent/codegen/src/main/java/com/speedment/common/codegen/util/Formatting.java