The Java language automatically converts primitive types to their boxed representations in some contexts (see JLS 5.1.7).

That is, prefer this:

int x;
Integer y = x;

to the equivalent but more verbose explicit conversion:

int x;
Integer y = Integer.valueOf(x);