Let $X$ be an almost surely non-negative random variable, then is it true that $X=\int_0^\infty 1_{\{X>s\}} ds$? I came across this claim in a proof in Kallenberg's Foundations of Modern Probability. I am guessing that must be trivial exercise but I can't see why it is so so any help will be really appreciated. Will it also be true if $f$ is any measurable numeric function so $f=\int_{-\infty}^\infty 1_{\{X>s\}} ds$?
Thanks in advance.