code: public static String loadAndFormatUsername(final String username, final int expectedNameLength) {
          final UserDetails userDetails = loadUserByUsername(username);
          return formatUserName(expectedNameLength, userDetails);
      }
docs: Load user details by the user name and format the user name. If the
  loaded {@link UserDetails} is not an instance of a {@link UserPrincipal},
  then just the {@link UserDetails#getUsername()} will return.
  
  If first and last name available, they will combined. Otherwise the
  {@link UserPrincipal#getLoginname()} will formatted. The formatted name
  is reduced to 100 characters.
  
  @param username
  the user name
  @param expectedNameLength
  the name size of each name part
  @return the formatted user name (max expectedNameLength characters)
  cannot be <null>