code: static int encode(int codePoint, char[] out, int j) {
          out[j++] = '&';
          out[j++] = '#';
          if (codePoint >= 1000) {
              out[j++] = (char) (codePoint / 1000 % 10 + '0');
          }
          if (codePoint >= 100) {
              out[j++] = (char) (codePoint / 100 % 10 + '0');
          }
          if (codePoint >= 10) {
              out[j++] = (char) (codePoint / 10 % 10 + '0');
          }
          out[j++] = (char) (codePoint % 10 + '0');
          out[j++] = ';';
          return j;
      }
docs: Appends the numerically encoded version of {@code codePoint} to the
  output buffer. Caller must insure there is enough space for the output.
  
  @param codePoint the character to encode
  @param out the output buffer
  @param j the offset where to write in the output buffer
  @return {@code j} + the encoded length.