@Override
    public String toString() {
        StringBuilder result = new StringBuilder();
        result.append(serviceName);
        if (hostName != null) {
            result.append('/');
            result.append(hostName);
        }
        if (realm != null) {
            result.append('@');
            result.append(realm);
        }
        return result.toString();
    }
Put the name back together from the parts.
clients/src/main/java/org/apache/kafka/common/security/kerberos/KerberosName.java