MATLAB scans column-wise the input matrix and writes them column-wise into the new matrix of specified matrix. Now i need to do that in Java, not a generic reshape, but for some specific cases. One of them is to transform a 1D array a[50400] into this 7D array c[2][12][4][5][5][7][3]. please, suggest how to do this.