code: private void checkIndices(int row, int col) {
          if (row < 0 || col < 0 || row >= rows || col >= columns) {
              throw new IndexOutOfBoundsException();
          }
      }
docs: Checks that the indices are within the bounds of this matrix or throws an
  {@link IndexOutOfBoundsException} if not.