transposing a 2d array math vector in java code example
Example: transpose of a matrix java
for (int row = 0; row < matrix.length; row++) {
for (int col = row; col < matrix[row].length; col++)
{
// Swap
int data = matrix[row][col];
matrix[row][col] = matrix[col][row];
matrix[col][row] = data;
}
}