Here you can find the source of invertMatrix(int[][] matrix)
public static int[][] invertMatrix(int[][] matrix)
//package com.java2s; //License from project: Open Source License public class Main { public static int[][] invertMatrix(int[][] matrix) { int[][] newMatrix = new int[matrix[0].length][matrix.length]; for (int x = 0; x < newMatrix[0].length; x++) { for (int y = 0; y < newMatrix.length; y++) { newMatrix[x][y] = matrix[y][x]; }/*from www.j a v a2 s .c om*/ } return newMatrix; } }