Here you can find the source of transposeBooleanMatrix(boolean[][] matrix)
Parameter | Description |
---|---|
matrix | a parameter |
public static boolean[][] transposeBooleanMatrix(boolean[][] matrix)
//package com.java2s; //License from project: Apache License public class Main { /**//from w w w . ja v a2 s. c o m * Transpose a 2D array of boolean * * @param matrix * @return */ public static boolean[][] transposeBooleanMatrix(boolean[][] matrix) { boolean[][] transposed = new boolean[matrix.length][matrix[0].length]; for (int rowIndex = 0; rowIndex < matrix.length; rowIndex++) { for (int columnIndex = 0; columnIndex < matrix[0].length; columnIndex++) { if (matrix[rowIndex][columnIndex]) { transposed[columnIndex][rowIndex] = true; } } } return transposed; } }