I know that this is not the answer you need, but according to JavaDoc - freeMemory returns:
a approximation to the total amount of memory currently available for future allocated objects, measured in bytes.
Just to check it out - I took your code and ran twice. Once with an array size of 10,000, and once with 100. I also added another snapshot right after:
Integer intArr[]= new Integer[10000];
When starting from 10,000 - I got the expected result, a decrease of 40,0016 bytes in free memory immediately after creating the array.
When working with 100 I got the same amount of free memory before and after creating the array - not the desired effect.
As already mentioned, most of the answers, since this is a native method, depends on the JVM and therefore can act differently on any platform. I am running Windows 7 using the Eclipse built-in JVM (v3.6) .
But I think the key word here is approximation .
source share