code: private String getInitials(String name)
     {
        String result = null;
  
        if (name != null && name.length() != 0)
        {
           StringBuilder sb = new StringBuilder();
           sb.append(name.charAt(0));
           int index = 1;
           while (true)
           {
              index = name.indexOf(' ', index);
              if (index == -1)
              {
                 break;
              }
  
              ++index;
              if (index < name.length() && name.charAt(index) != ' ')
              {
                 sb.append(name.charAt(index));
              }
  
              ++index;
           }
  
           result = sb.toString();
        }
  
        return result;
     }
docs: Convert a name into initials.
  
  @param name source name
  @return initials