A sphere B have radius R. The center point is located the origin of space $\mathbf R^3$. The density of a sphere depends on the distance $r=\sqrt{x^2+y^2+z^2}$.
I want to calculate the mass of that sphere.
mass $m = \iiint \rho\, dV$ = $\int_V\rho(r)\, dV$
The volume $V(r) = {4 \over 3} \pi r^3 \to {d V(r) \over dr} = 4 \pi r^2$
After that we get:
$4\pi\int\rho(r)*r^2\,dr$
But what are the limit values of the integration?
The distance to the origin can range from $r=0$ (at the origin) to $r=R$ (on the surface). Hence the bounds of integration are $0$ and $R$; in other words, your integral is $$4\pi\int_0^R\rho(r)r^2\;dr.$$