Well I do get crazy when I start experimenting some times. Never dared to do this in real life aparting from pushing my limits when it came to swallowing stuffs and touching electric bulbs. But I really do feel like I get very crazy when it comes to my computers. It does not cost me much ehh... apart from the time I spent on doing it :D
Coming to the point, I grew interest in Nano technology, Astronomy, Relativity, Time Travel, Beyond 3 Diminsions... and there I was, I am not that good in science yet to show you guys the fourth dimension, but how about it in Java ROFL. I went up till 23 dimensions LOL. 23-Dimensional array.
I wrote down the following class
package com.oz.core.Arrays;
public class ArrayExperiments {
public static void main(String args[]) {
int[] intArray = new int[10];
int[][] int2dArray = new int[10][10];
int[][][] int3dArray = new int[10][10][10];
int [][][][] int4dArray=new int [10][10][10][10] ;
int [][][][][] int5dArray=new int [10][10][10][10][10] ;
int [][][][][][] int6dArray=new int [10][10][10][10][10][10] ;
int [][][][][][][] int7dArray=new int [10][10][10][10][10][10][10] ;
int [][][][][][][][] int8dArray=new int [10][10][10][10][10][10][10][10] ;
int [][][][][][][][][] int9dArray=new int [10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][] int10dArray=new int [10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][] int11dArray=new int [10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][] int12dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][] int13dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][] int14dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][] int15dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][][] int16dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][][][] int17dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][][][][] int18dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][][][][][] int19dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][][][][][][] int20dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][][][][][][][] int21dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][][][][][][][][] int22dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int [][][][][][][][][][][][][][][][][][][][][][][] int23dArray=new int [10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10][10] ;
int5dArray[1][2][3][4][5]=999 ;
int6dArray[1][2][3][4][5][6]=1999 ;
int7dArray[1][2][3][4][5][6][7]=2999 ;
System.out.printf("%d + %d + %d = "+
int5dArray[1][2][3][4][5]+
int6dArray[1][2][3][4][5][6]+
int7dArray[1][2][3][4][5][6][7],
int5dArray[1][2][3][4][5],
int6dArray[1][2][3][4][5][6],
int7dArray[1][2][3][4][5][6][7]);
}
}
And I ran it eagerly to see what happens. LOL the following happened. I did it again, but this time the crashed the JVM and not the LOTUS DOMINO SERVER rofl
JVMDUMP006I Processing dump event "systhrow", detail "java/lang/OutOfMemoryError" - please wait.
JVMDUMP032I JVM requested Heap dump using 'C:\Accurev_work\Ozinisle\heapdump.20150211.175635.9948.0001.phd' in response to an event
JVMDUMP010I Heap dump written to C:\Accurev_work\Ozinisle\heapdump.20150211.175635.9948.0001.phd
JVMDUMP032I JVM requested Java dump using 'C:\Accurev_work\Ozinisle\javacore.20150211.175635.9948.0002.txt' in response to an event
JVMDUMP010I Java dump written to C:\Accurev_work\Ozinisle\javacore.20150211.175635.9948.0002.txt
JVMDUMP032I JVM requested Snap dump using 'C:\Accurev_work\Ozinisle\Snap.20150211.175635.9948.0003.trc' in response to an event
JVMDUMP006I Processing dump event "systhrow", detail "java/lang/OutOfMemoryError" - please wait.
JVMDUMP010I Snap dump written to C:\Accurev_work\Ozinisle\Snap.20150211.175635.9948.0003.trc
JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".
JVMDUMP032I JVM requested Heap dump using 'C:\Accurev_work\Ozinisle\heapdump.20150211.175705.9948.0004.phd' in response to an event
JVMDUMP010I Heap dump written to C:\Accurev_work\Ozinisle\heapdump.20150211.175705.9948.0004.phd
JVMDUMP032I JVM requested Java dump using 'C:\Accurev_work\Ozinisle\javacore.20150211.175705.9948.0005.txt' in response to an event
JVMDUMP010I Java dump written to C:\Accurev_work\Ozinisle\javacore.20150211.175705.9948.0005.txt
JVMDUMP032I JVM requested Snap dump using 'C:\Accurev_work\Ozinisle\Snap.20150211.175705.9948.0006.trc' in response to an event
JVMDUMP010I Snap dump written to C:\Accurev_work\Ozinisle\Snap.20150211.175705.9948.0006.trc
JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".
Exception in thread "main" java.lang.OutOfMemoryError
Exception in thread "Attach API wait loop" at com.oz.core.Arrays.ArrayExperiments.main(ArrayExperiments.java:14)
java.lang.OutOfMemoryError
at com.ibm.tools.attach.javaSE.TargetDirectory.getTargetDirectoryPath(TargetDirectory.java:66)
at com.ibm.tools.attach.javaSE.AttachHandler.connectToAttacher(AttachHandler.java:274)
at com.ibm.tools.attach.javaSE.AttachHandler$WaitLoop.checkReplyAndCreateAttachment(AttachHandler.java:371)
at com.ibm.tools.attach.javaSE.AttachHandler$WaitLoop.waitForNotification(AttachHandler.java:366)
at com.ibm.tools.attach.javaSE.AttachHandler$WaitLoop.run(AttachHandler.java:396)
And this time let me be @%$*&$! Less greedy
package com.oz.core.Arrays;
public class ArrayExperiments {
public static void main(String args[]) {
int[] intArray = new int[10];
int[][] int2dArray = new int[10][10];
int[][][] int3dArray = new int[10][10][10];
int [][][][] int4dArray=new int [10][10][10][10] ;
int [][][][][] int5dArray=new int [10][10][10][10][10] ;
int2dArray[1][2]=999 ;
int3dArray[1][2][3]=1999 ;
int4dArray[1][2][3][4]=2999 ;
System.out.printf("%d + %d + %d = "+
int2dArray[1][2]+
int3dArray[1][2][3]+
int4dArray[1][2][3][4],
int2dArray[1][2],
int3dArray[1][2][3],
int4dArray[1][2][3][4]);
}
}
And this gave a decent out put
999 + 1999 + 2999 = 99919992999
Wait what!!!! Lol rofl
No comments:
Post a Comment