Evaluation of a surface integral in Electromagnetism There is an integral that I stumbled upon when I saw a calculation related to magnetic field energy (in static current density case) 
$$
U_B= \int_\text{whole space} \mathbf j \cdot \mathbf A \:\mathrm dV 
.
$$ 
The integral is expanded using Maxwell's Laws and we reach to something like this 
$$
U_B
=
C\left(
\int_\text{whole space} \mathbf B\times \mathbf A \cdot \mathbf n \:\mathrm dS 
+ \int_\text{whole space} \mathbf B\cdot \mathbf B \:\mathrm dV
\right),
$$
where $C$ is a constant. 
Then the first integral is taken to be zero. There was no logic stated behind this. Is there is some trivial fact that I am missing because I cannot figure any reason for the first integral to be $0$.
 A: This condition essentially needs to be imposed 'on faith', to some degree, because we intuitively feel that physical sources should be localized, and for those we can work out that the fields decay fast enough that the surface term vanishes.
This is not to say that we're just wishing away terms that we find inconvenient: instead, we explicitly make the caveat that what follows is valid for localized sources only ─ and we make the slightly circular definition that a 'localized source' (or a localized field) is one for which the relevant surface terms vanish.
In the majority of cases, it is very hard to come up with a (useful) necessary condition on the fields and sources which is equivalent to the vanishing of that surface term. We know plenty of sufficient conditions (of the form 'for such-and-such class of localized sources, the surface term vanishes'), and those are broad enough to cover most cases of interest, but it's hard to make more general statements.
In a sense, this is more of a "credit" view of mathematical rigour, as opposed to the "debit" view that mathematicians tend to hold: where they say "OK, my fields satisfy X and Y niceness hypotheses, let's work out what results I can prove from those", physicists tend to tell rigour "well, I want that term to go away, so you can just bill me later by telling me what conditions my fields need to satisfy for my formalism to hold".
And indeed, this kind of assumption can indeed come back and bite us. One famous example is the separation of optical angular momentum into orbital and spin contributions, as described here, via an integration by parts of the form
$$
\mathbf J 
=
\frac{1}{\mu_0c^2} \int\mathrm d\mathbf r \: \mathbf r \times (\mathbf E\times\mathbf B)
= \frac{1}{\mu_0c^2} \int\mathrm d\mathbf r \:  (E_i (\mathbf r \times\nabla) A_i )
+ \frac{1}{\mu_0c^2} \int\mathrm d\mathbf r \: \mathbf E\times \mathbf A
=\mathbf L + \mathbf S,
$$
where you get this weird paradox: if you plug in a circularly-polarized plane wave, then $\mathbf L$ is zero but $\mathbf S$ is not, but the initial $\mathbf J$ also seems to vanish, so something is off: the problem here is that the boundary terms (or the regions where the beam tapers off) carry nonzero angular momentum, and cannot be neglected. This apparent paradox has puzzled many an unsuspecting author.
Nevertheless, we still use the equation (as we do with the one you mentioned) because it holds for what we think are physical fields, and we're prepared to say "it's zero because I say so" and accept that if it's not zero then the fields are probably not physical and we shouldn't be using them as such.
