code: public double[][] toDenseArray() {
          int r = rows.get();
          int c = cols.get();
          for (int i = 0; i < r; ++i) 
              lockRow(i, c);
  
          double[][] m = new double[r][0];
          for (int i = 0; i < r; ++i) {
              DoubleVector row = getRowVector(i);
              // Ensure that we see a consistent length for all the rows
              if (row.length() != c)
                  row = Vectors.subview(row, 0, c);
              m[i] = row.toArray();
          }
  
          for (int i = 0; i < r; ++i) 
              unlockRow(i, c);
          
          return m;
      }
docs: {@inheritDoc}