Description
The method ObjectUtils.identityToString(Object) and its friends should allocate builders and buffers with a size.
Calling ObjectUtils.identityToString(Object) will allocate a StringBuilder and append to it. The StringBuilder will reallocate it's internal char[] at least once since most strings end up being larger than the default 16 characters initially allocated by a StringBuilder (on Oracle Java 7).
This change computes the strings part first (class name and hex hash code string) and then allocates a StringBuilder of the right size.
Similarly, the identityToString methods that accept an existing builder/buffer can call ensureCapacity to avoid any extraneous allocations.