else
  private static int scanFormatElement(String pat, int index,                                       StringBuffer buffer, char term)  {    int max = pat.length();    buffer.setLength(0);    int brace_depth = 1;    for (; index < max; ++index)      {	char c = pat.charAt(index);	if (c == '\'' && index + 2 < max && pat.charAt(index + 2) == '\'')	  {	    buffer.append(c);	    buffer.append(pat.charAt(index + 1));	    buffer.append(c);	    index += 2;	  }	else if (c == '\'' && index + 1 < max		 && pat.charAt(index + 1) == '\'')	  {	    buffer.append(c);	    ++index;	  }	else if (c == '{')	  {	    buffer.append(c);	    ++brace_depth;	  }	else if (c == '}')	  {	    if (--brace_depth == 0)	      break;	    buffer.append(c);	  }	// Check for TERM after braces, because TERM might be `}'.	else if (c == term)	  break;	else	  buffer.append(c);      }    return index;  }