code: public Matrix getMatrix(int[] r, int j0, int j1)
      {
          Matrix X = new Matrix(r.length, j1 - j0 + 1);
          double[][] B = X.getArray();
          try
          {
              for (int i = 0; i < r.length; i++)
              {
                  for (int j = j0; j <= j1; j++)
                  {
                      B[i][j - j0] = A[r[i]][j];
                  }
              }
          }
          catch (ArrayIndexOutOfBoundsException e)
          {
              throw new ArrayIndexOutOfBoundsException("Submatrix indices");
          }
          return X;
      }
docs: Get a submatrix.
  
  @param r  Array of row indices.
  @param j0 Initial column index
  @param j1 Final column index
  @return A(r(:), j0:j1)
  @throws ArrayIndexOutOfBoundsException Submatrix indices