Any type may be converted to type String by string conversion.
A value x of primitive type T is first converted to a reference value as if by
giving it as an argument to an appropriate class instance creation expression:
• If T is boolean, then use new Boolean(x) (§20.4).
• If T is char, then use new Character(x) (§20.5).
• If T is byte, short, or int, then use new Integer(x) (§20.7).
• If T is long, then use new Long(x) (§20.8).
• If T is float, then use new Float(x) (§20.9).
• If T is double, then use new Double(x) (§20.10).
This reference value is then converted to type String by string conversion.
Now only reference values need to be considered. If the reference is null, it is
converted to the string "null" (four ASCII characters n, u, l, l). Otherwise, the
conversion is performed as if by an invocation of the toString method of the referenced
object with no arguments; but if the result of invoking the toString
method is null, then the string "null" is used instead. The toString method
(§20.1.2) is defined by the primordial class Object (§20.1); many classes override
it, notably Boolean, Character, Integer, Long, Float, Double, and String.
--java language specification 3rd p355