Please check if the solution to the following problem is correct or not. If there is any flaw then please help me to correct it.
Problem: Let $f:(0,\infty)\to(0,\infty)$ be a decreasing function, satisfying $$I=\int\limits_{0}^{\infty}f(x) \, \mathrm{d} x<\infty.$$ Prove that $\lim\limits_{x\to\infty}xf(x)=0$.
Solution: Let us assume that $f$ be a decreasing function such that $\lim\limits_{x\to\infty}xf(x)=l \, ,l>0$. Since $xf(x)>0$ for $x>0$, $\lim\limits_{x\to\infty}xf(x)$ cannot be negative.
Case 1. Let $l=\infty$. Then given any $M>0 \, \exists a=\frac{M}{f(a)}>0$ such that for any $x>a$, $xf(x)>M$. Then $$g(t)=\int\limits_{0}^{t}f(x) \, \mathrm{d} x=\int\limits_{a}^{t}f(x) \, \mathrm{d} x+\int\limits_{0}^{a}f(x) \, \mathrm{d} x>\int\limits_{0}^{a}f(a)\, \mathrm{d} x=af(a)=M.$$ Hence given any $M>0$ $\exists a=a(M)>0$ such that for any $t>a$, $g(t)>M$. Hence $\lim\limits_{t\to\infty}g(t)=\infty$. Thus $I=\infty$.
Case 2. Let $0<l<\infty$. Then given any $\epsilon>0 \, \exists \delta=\frac{\epsilon}{f(\delta)}>0$ such that for any $x>a$, $|xf(x)-l|<\epsilon$. Then $$g(t)=\int\limits_{0}^{t}f(x) \, \mathrm{d} x=\int\limits_{\delta}^{t}f(x) \, \mathrm{d} x+\int\limits_{0}^{\delta}f(x) \, \mathrm{d} x>\int\limits_{0}^{\delta}f(\delta) \, \mathrm{d} x=\delta f(\delta)=\epsilon.$$ Hence given any $\epsilon>0$ $\exists \delta=\delta(\epsilon)>0$ such that for any $t>\delta$, $g(t)>\epsilon$. Hence $\lim\limits_{t\to\infty}g(t)=\infty$. Thus $I=\infty$. Hence in both the cases we get a contradiction to the fact that $I<\infty$.
Thus $\lim\limits_{x\to\infty}xf(x)=0$.
Thank you.
Since $f$ is decreasing, you have $$\frac{1}{x}\int_x^{2x}f(t)dt\leqslant f(x)\leqslant\frac{2}{x}\int_{x/2}^{x}f(t)dt$$ and $\int_0^{+\infty}f(t)dt<+\infty$ so $\int_{x}^{2x}f(t)dt=\int_0^{2x}f(t)dt-\int_0^x f(t)dt\underset{x\rightarrow +\infty}{\longrightarrow}0$, by the same argument we have $\int_{x/2}^{x}f(t)dt\underset{x\rightarrow +\infty}{\longrightarrow}0$ so that $\lim\limits_{x\rightarrow +\infty}xf(x)=0$.