code: private static int escape(char[] cc, char c, int index) {
          cc[index++] = '%';
          cc[index++] = Character.forDigit((c >> 4) & 0xF, 16);
          cc[index++] = Character.forDigit(c & 0xF, 16);
          return index;
      }
docs: Appends the URL escape sequence for the specified char to the
  specified StringBuffer.