code: protected EntityDecl getIntEntity(int ch, final char[] originalChars)
      {
          String cacheKey = new String(originalChars);
  
          IntEntity entity = mCachedEntities.get(cacheKey);
          if (entity == null) {
              String repl;
              if (ch <= 0xFFFF) {
                  repl = Character.toString((char) ch);
              } else {
                  StringBuffer sb = new StringBuffer(2);
                  ch -= 0x10000;
                  sb.append((char) ((ch >> 10)  + 0xD800));
                  sb.append((char) ((ch & 0x3FF)  + 0xDC00));
                  repl = sb.toString();
              }
              entity = IntEntity.create(new String(originalChars), repl);
              mCachedEntities.put(cacheKey, entity);
          }
          return entity;
      }
docs: Returns an entity (possibly from cache) for the argument character using the encoded
  representation in mInputBuffer[entityStartPos ... mInputPtr-1].