How can I convert an Array [1, 2, 3, 4, 5, 6, 7 ,8, 9, 10, 11, 12] to a 2D-Array looking like this?
[[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10, 11, 12]]
Always 3 Numbers in a row.
What I have tried returns the first line correct, but the other lines are the same as the first.
for (int i = 0; i < array.length; ++i) {
for (int k = 0; k < 3; ++k) {
result[k][i] = args[i];
}