I have tried the following way:
int[][] Matrix=new int[Integer.MAX_VALUE-5][Integer.MAX_VALUE-5];
But I get this exception: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.
What i mean is i want to store a matrix of nxn size where n is around 500000, but my Netbeans shows out of memory exception for just 10000, how would i increase the memory