public static String normalize(final String s) {
        if (s == null) {
            return null;
        }
        int pos = 0;
        int remaining = s.length();
        while (remaining > 0) {
            if (isUpper(s.charAt(pos))) {
                break;
            }
            pos++;
            remaining--;
        }
        if (remaining > 0) {
            final StringBuilder buf = new StringBuilder(s.length());
            buf.append(s, 0, pos);
            while (remaining > 0) {
                final char c = s.charAt(pos);
                if (isUpper(c)) {
                    buf.append((char) (c + ('a' - 'A')));
                } else {
                    buf.append(c);
                }
                pos++;
                remaining--;
            }
            return buf.toString();
        }
        return s;
    }
A collection of utilities relating to Domain Name System.

@since 4.5
httpclient5/src/main/java/org/apache/hc/client5/http/utils/DnsUtils.java