How do you know when you can move something outside the integral to be later multiplied by the integrated function?

For example,

$\displaystyle \int_0^4\pi(x^2)dx$ vs. $\displaystyle \pi\int_0^4(x^2)dx$

And please remember, this is Calculus I. Thanks.