in my unit test I deliberately trying to raise an OutOfMemoryError exception. I use a simple statement like the following:
byte[] block = new byte[128 * 1024
128*1024*1024*1024=0 because int is 32-bit. Java doesn't support arrays larger than 4Gb.