Integer vs int: with regard to memory
In general, the heap memory used by a Java object in Hotspot consists of: an object header, consisting of a few bytes of “housekeeping” information; memory for primitive fields, according to their size (int n->32 bits) memory for reference fields (4 bytes each) (Integer n ->32 bits) padding: potentially a few “wasted” unused bytes after … Read more