Looks for usages of new
for wrapper classes which should use valueOf
instead
You should not call the constructor for wrapper classes directly, such as`new Integer(42)`. Instead, call the valueOf
factory method, such as Integer.valueOf(42)
. This will typically use less memory because common integers such as 0 and 1 will share a single instance.