code: public static String useCasedString(String replaceable, String replacement) {
        String replacementCased = replacement;
        if (replacement.length() > 1) {
            // If the first char of the replaceable lexeme is upper case...
            if (Character.isUpperCase(replaceable.charAt(0))) {
                // ... so must be its replacement.
                replacementCased = Character.toUpperCase(replacement.charAt(0)) + replacement.substring(1);
            } else {
                // ... the replacement must be lower case.
                replacementCased = Character.toLowerCase(replacement.charAt(0)) + replacement.substring(1);
            }
        } else if (replacement.length() == 1) {
            // If the first char of the replaceable lexeme is upper case...
            if (Character.isUpperCase(replaceable.charAt(0))) {
                // ... so must be its replacement.
                replacementCased = String.valueOf(Character.toUpperCase(replacement.charAt(0)));
            } else {
                // ... the replacement must be lower case.
                replacementCased = String.valueOf(Character.toLowerCase(replacement.charAt(0)));
            }
        }
        return replacementCased;
    }
docs: Checks the case of the first char from <code>replaceable</code> and changes the first char from the
  <code>replacement</code> accordingly.
  
  @param replaceable
  the string that will be replaced
  @param replacement
  the string that will be used to replace the <code>replaceable</code>
  @return the replacement, beginning with upper case if the <code>replaceable</code> begins too or
  lower case, if not