code: public Matrix insertRow(int i, Vector row) {
          if (i > rows || i < 0) {
              throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + rows);
          }
  
          Matrix result;
          if (columns == 0) {
              result = blankOfShape(rows + 1, row.length());
          } else {
              result = blankOfShape(rows + 1, columns);
          }
  
          for (int ii = 0; ii < i; ii++) {
              result.setRow(ii, getRow(ii));
          }
  
          result.setRow(i, row);
  
          for (int ii = i; ii < rows; ii++) {
              result.setRow(ii + 1, getRow(ii));
          }
  
          return result;
      }
docs: Adds one row to matrix.
  @param i the row index
  @return matrix with row.