String () { StringBuilder sb = new StringBuilder(); sb.append("Matrix ").append(height).append("x").append(width).append(" { "); for (int i = 0, h = 0; h < height; h++) { if (h != 0) sb.append(", "); sb.append("{"); for (int w = 0; w < width; w++, i++) { if (w != 0) sb.append(", "); sb.append(vector.get(i)); } sb.append("}"); } return sb.append(" }").toString(); }