How large is the Integer cache?
Class Integer has cache, which caches the Integer values. So if I use method valueOf or inboxing the new value will not be instantiated, but get from the cache. I know that the default cache size is 127 but can be extended due to VM settings. My question is: how large is the default value of cache size in these settings and can I manipulate this value? Is this value depended on which VM I use (32 or 64 bits)? I'm now on tuning of a legacy code, and probably will need the conversion from int to Integer. Clarification: Following code I've found in Java source private static class IntegerCache {