There is no such thing as a 2-D array. What you are showing is an array of arrays, which is actually better than a 2-D array.
What are you trying to change? You said “array” in the thread title and “ArrayList” later on. You cannot get an array out of an element.
What you are trying to do is count the first 3 elements, put them into an array, then repeat. It is a simple enough operation if you remember what the 5 arithmetical operators are.
Joined: Oct 13, 2005
Don’t use literals in for loops if you can possibly avoid it. There is a .length field implicitly available in every array, which you can use in the for loop.
subject: Algorithm to convert 1-d array to 2-d array