The problem in your example is that the create function of the array expects an int as an argument, and you passed a long one.
This compiles:
long size = 0xFFFFFFFF;
But does not work. It does not work in this particular long example, because the number is negative, and you simply cannot create an array with a negative number of elements. Nevertheless, to create an array, you can use a long variable, but it must be a positive number and must be passed to int, for example:
long size = 0x00FFFFFF;
What will compile and work.
By the way, switching from size to Integer.MAX_VALUE will not achieve anything if it exceeds the limits of your JVM memory.
Bruno vieira
source share