Here you can find the source of transpose(Object[][] matrix)
Parameter | Description |
---|---|
matrix | Matrix to be transposed |
public static Object[][] transpose(Object[][] matrix)
//package com.java2s; //License from project: Apache License public class Main { /**/*from ww w. ja v a 2s . c om*/ * Transposes the matrix * @param matrix Matrix to be transposed * @return a transposed copy of the matrix */ public static Object[][] transpose(Object[][] matrix) { Object[][] temp = new Object[matrix[0].length][matrix.length]; for (int i = 0; i < matrix.length; i++) for (int j = 0; j < matrix[0].length; j++) temp[j][i] = matrix[i][j]; return temp; } }