line += padString("(" + Utils.doubleToString(getCount(i-1), 0) + ")",
line += padString("(" + Utils.doubleToString(getCount(getDisplayRow(i-1)), 0) + ")",
  public String toStringMatrix() {    StringBuffer    result;    String[][]      cells;    int             i;    int             j;    int             n;    int             k;    int             size;    String          line;    int             indexBase;    int             indexSecond;    StringBuffer    head;    StringBuffer    body;    StringBuffer    foot;    int[]           startMeans;    int[]           startSigs;    int             maxLength;    result     = new StringBuffer();    head       = new StringBuffer();    body       = new StringBuffer();    foot       = new StringBuffer();    cells      = toArray();    startMeans = new int[getColCount()];    startSigs  = new int[getColCount() - 1];    maxLength  = 0;    // pad numbers    for (n = 1; n < cells[0].length; n++) {      size = getColSize(cells, n, true, true);      for (i = 1; i < cells.length - 1; i++)        cells[i][n] = padString(cells[i][n], size, true);    }    // index of base column in array    indexBase = 1;    if (getShowStdDev())      indexBase++;    // index of second column in array    indexSecond = indexBase + 1;    if (getShowStdDev())      indexSecond++;    // output data (without "(v/ /*)")    j = 0;    k = 0;    for (i = 1; i < cells.length - 1; i++) {      line = "";            for (n = 0; n < cells[0].length; n++) {        // record starts        if (i == 1) {          if (isMean(n)) {            startMeans[j] = line.length();            j++;          }          if (isSignificance(n)) {            startSigs[k] = line.length();            k++;          }        }                if (n == 0) {          line += padString(cells[i][n], getRowNameWidth());          line += padString("(" + Utils.doubleToString(getCount(i-1), 0) + ")",                         getCountWidth(), true);        }        else {          // additional space before means          if (isMean(n))            line += "  ";          // print cell          if (getShowStdDev()) {            if (isMean(n - 1)) {              if (!cells[i][n].trim().equals(""))                              line += "(" + cells[i][n] + ")";              else                line += " " + cells[i][n] + " ";            }            else              line += " " + cells[i][n];          }          else {            line += " " + cells[i][n];          }        }        // add separator after base column        if (n == indexBase)          line += " |";      }      // record overall length      if (i == 1)        maxLength = line.length();            body.append(line + "\n");    }    // column names    line = padString(cells[0][0], startMeans[0]);    i    = -1;    for (n = 1; n < cells[0].length; n++) {      if (isMean(n)) {        i++;        if (i == 0)          line = padString(line, startMeans[i] - getCountWidth());        else if (i == 1)          line = padString(line, startMeans[i] - " |".length());        else if (i > 1)          line = padString(line, startMeans[i]);                if (i == 1)          line += " |";                line += " " + cells[0][n];      }    }    line = padString(line, maxLength);    head.append(line + "\n");    head.append(line.replaceAll(".", "-") + "\n");    body.append(line.replaceAll(".", "-") + "\n");    // output wins/losses/ties    if (getColCount() > 1) {      line = padString(cells[cells.length - 1][0], startMeans[1]-2, true) + " |";      i    = 0;      for (n = 1; n < cells[cells.length - 1].length; n++) {        if (isSignificance(n)) {          line = padString(                  line, startSigs[i] + 1 - cells[cells.length - 1][n].length());          line += " " + cells[cells.length - 1][n];          i++;        }      }      line = padString(line, maxLength);    }    else {      line = padString(cells[cells.length - 1][0], line.length() - 2) + " |";    }    foot.append(line + "\n");        // assemble output    result.append(head.toString());    result.append(body.toString());    result.append(foot.toString());    return result.toString();  }