code: public static String resolve(String normalized)
     {
        StringBuilder builder = new StringBuilder();
        int end = normalized.length();
        int pos = normalized.indexOf('&');
        int last = 0;
  
        // No references
        if (pos == -1)
           return normalized;
  
        while (pos != -1)
        {
           String sub = normalized.subSequence(last, pos).toString();
           builder.append(sub);
           
           int peek = pos + 1;
           if (peek == end)
              throw MESSAGES.entityResolutionInvalidEntityReference(normalized);
  
           if (normalized.charAt(peek) == '#')
              pos = resolveCharRef(normalized, pos, builder);
           else
              pos = resolveEntityRef(normalized, pos, builder);
  
           last = pos;
           pos = normalized.indexOf('&', pos);
        }
  
        if (last < end)
        {
           String sub = normalized.subSequence(last, end).toString();
           builder.append(sub);
        }
  
        return builder.toString();
     }
docs: Transforms an XML normalized string by resolving all predefined character and entity references
  
  @param normalized an XML normalized string
  @return a standard java string that is no longer XML normalized