Copying one dimensional array bottom to top
OK, so from what I can understand about your problem is that you want to "chunk" up a one-dimensional array into a two-dimensional array with rows rows and columns columns.

I'm going to assume row-major form since that's a little bit more typical (and seems to be what your code does too).

First of all, I don't understand the condition where it has to be written from bottom to up. I don't see any reason for this, but we'll assume we do have to do that for whatever reason.

Your code does not quite work, because you've confused the row variable and the maxrowIndex variable. In the part where you are attempting to calculate the one-dimensional index based on a given row and column you use this maxrowIndex variable which hints at it actually storing the current row index. But you do not use this when indexing your two-dimensional array.

In terms of style, I have to say that I'm not a fan of opening the brace { on the next line, and especially not indenting twice each time you nest.

Here's how I would approach the problem:

Edit: clarification - the data was original written north to south ([0][0] would have been the north west corner) and we need to flip vertically so that the new [0][0] should be the south west corner.

// We ignore the first row of the original array (which is the last row of the new 2d array
for (int row = 0; row &lt; rows - 1; row++) {
    // From first column to second last column (skips last column)
    for (int column = 0; column &lt; columns; columns++) {
        int originalRow = rows - 1 - row;
        twodim[row][column] = onedim[originalRow*columns + column];
    }
}