Example 8 The three sides of a triangle are consecutive integers. Find the lengths of the three sides according to the following two conditions:
(1) The largest angle is twice the smallest angle;
(2) It is an obtuse or right triangle.
Consider $\triangle A B C$ with side lengths $n-1$, $n$, and $n+1$, and their corresponding angles $\angle A$, $\angle B$, and $\angle C$, which are also arranged in ascending order.
(1) Since $(n-1)+(n+1)=2 n$, by the Law of Sines, we have
$$
\sin A+\sin C=2 \sin B=2 \sin (A+C).
$$

Given $\angle C=2 \angle A$, we get
$$
\sin A+\sin 2 A=2 \sin 3 A,
$$

which simplifies to $2 \sin \frac{3 A}{2} \cdot \cos \frac{A}{2}=4 \sin \frac{3 A}{2} \cdot \cos \frac{3 A}{2}$. Since $2 \sin \frac{3 A}{2} \neq 0\left(0^{\circ}<A<60^{\circ}\right)$, we have
$$
\cos \frac{A}{2}=2 \cos \frac{3 A}{2}.
$$

Thus,
$$
\cos \frac{A}{2}=2\left(2 \cos ^{2} \frac{A}{2}-1\right) \Rightarrow 4 \cos ^{2} \frac{A}{2}-\cos \frac{A}{2}-2=0.
$$

Solving this, we get
$$
\cos \frac{A}{2}=\frac{1 \pm \sqrt{33}}{8}.
$$

Since $\cos \frac{A}{2}>0$, we have
$$
\cos \frac{A}{2}=\frac{1+\sqrt{33}}{8}.
$$

Therefore,
$$
\cos A=2 \cos ^{2} \frac{A}{2}-1=\frac{1+2 \sqrt{33}}{32}.
$$

By the Law of Cosines,
$$
\cos A=\frac{n^{2}+(n+1)^{2}-(n-1)^{2}}{2 n(n+1)}=\frac{n+4}{2(n+1)}.
$$

Thus,
$$
\frac{n+4}{2(n+1)}=\frac{1+2 \sqrt{33}}{32} \Rightarrow 16(n+4)=(n+1)(1+2 \sqrt{33}).
$$

Solving this, we get
$$
n=\frac{63-2 \sqrt{33}}{15-2 \sqrt{33}}=3.
$$

Since $n-1<n<n+1$, we know $n>2$.
Because $\angle C \geqslant 90^{\circ}$, we have
$$
\cos C=\frac{(n-1)^{2}+n^{2}-(n+1)^{2}}{2(n-1) n} \leqslant 0.
$$

Noting that the denominator is positive, the numerator
$$
n^{2}-4 n \leqslant 0 \Rightarrow n \leqslant 4.
$$

Therefore, the integer $n=3,4$.
Thus, the side lengths of $\triangle A B C$ are $2, 3, 4$ or
$3, 4, 5$.