static FormattingTuple arrayFormat(final String messagePattern,
                                     final Object[] argArray) {

    Throwable throwableCandidate = getThrowableCandidate(argArray);

    if (messagePattern == null) {
      return new FormattingTuple(null, argArray, throwableCandidate);
    }

    if (argArray == null) {
      return new FormattingTuple(messagePattern);
    }

    int i = 0;
    int j;
    StringBuffer sbuf = new StringBuffer(messagePattern.length() + 50);

    int L;
    for (L = 0; L < argArray.length; L++) {

      j = messagePattern.indexOf(DELIM_STR, i);

      if (j == -1) {
        // no more variables
        if (i == 0) { // this is a simple string
          return new FormattingTuple(messagePattern, argArray,
              throwableCandidate);
        } else { // add the tail string which contains no variables and return
          // the result.
          sbuf.append(messagePattern.substring(i, messagePattern.length()));
          return new FormattingTuple(sbuf.toString(), argArray,
              throwableCandidate);
        }
      } else {
        if (isEscapedDelimeter(messagePattern, j)) {
          if (!isDoubleEscaped(messagePattern, j)) {
            L--; // DELIM_START was escaped, thus should not be incremented
            sbuf.append(messagePattern.substring(i, j - 1));
            sbuf.append(DELIM_START);
            i = j + 1;
          } else {
            // The escape character preceding the delimiter start is
            // itself escaped: "abc x:\\{}"
            // we have to consume one backward slash
            sbuf.append(messagePattern.substring(i, j - 1));
            deeplyAppendParameter(sbuf, argArray[L], new HashMap<Object[], Void>());
            i = j + 2;
          }
        } else {
          // normal case
          sbuf.append(messagePattern.substring(i, j));
          deeplyAppendParameter(sbuf, argArray[L], new HashMap<Object[], Void>());
          i = j + 2;
        }
      }
    }
    // append the characters following the last {} pair.
    sbuf.append(messagePattern.substring(i, messagePattern.length()));
    if (L < argArray.length - 1) {
      return new FormattingTuple(sbuf.toString(), argArray, throwableCandidate);
    } else {
      return new FormattingTuple(sbuf.toString(), argArray, null);
    }
  }
static FormattingTuple arrayFormat ( final String messagePattern , final Object [ ] argArray ) { Throwable throwableCandidate = getThrowableCandidate ( argArray ) ; if ( messagePattern == null ) { return new FormattingTuple ( null , argArray , throwableCandidate ) ; } if ( argArray == null ) { return new FormattingTuple ( messagePattern ) ; } int i = 0 ; int j ; StringBuffer sbuf = new StringBuffer ( messagePattern . length ( ) + 50 ) ; int L ; for ( L = 0 ; L < argArray . length ; L ++ ) { j = messagePattern . indexOf ( DELIM_STR , i ) ; if ( j == - 1 ) { if ( i == 0 ) { return new FormattingTuple ( messagePattern , argArray , throwableCandidate ) ; } else { sbuf . append ( messagePattern . substring ( i , messagePattern . length ( ) ) ) ; return new FormattingTuple ( sbuf . toString ( ) , argArray , throwableCandidate ) ; } } else { if ( isEscapedDelimeter ( messagePattern , j ) ) { if ( ! isDoubleEscaped ( messagePattern , j ) ) { L -- ; sbuf . append ( messagePattern . substring ( i , j - 1 ) ) ; sbuf . append ( DELIM_START ) ; i = j + 1 ; } else { sbuf . append ( messagePattern . substring ( i , j - 1 ) ) ; deeplyAppendParameter ( sbuf , argArray [ L ] , new HashMap < Object [ ] , Void > ( ) ) ; i = j + 2 ; } } else { sbuf . append ( messagePattern . substring ( i , j ) ) ; deeplyAppendParameter ( sbuf , argArray [ L ] , new HashMap < Object [ ] , Void > ( ) ) ; i = j + 2 ; } } } sbuf . append ( messagePattern . substring ( i , messagePattern . length ( ) ) ) ; if ( L < argArray . length - 1 ) { return new FormattingTuple ( sbuf . toString ( ) , argArray , throwableCandidate ) ; } else { return new FormattingTuple ( sbuf . toString ( ) , argArray , null ) ; } }
Same principle as the {@link #format(String, Object)} and
{@link #format(String, Object, Object)} methods except that any number of
arguments can be passed in an array.

@param messagePattern The message pattern which will be parsed and formatted
@param argArray       An array of arguments to be substituted in place of formatting
anchors
@return The formatted message