Here you can find the source of toObjectArraySquareMatrix(T[][] matrixT)
public static <T> Object[][] toObjectArraySquareMatrix(T[][] matrixT)
//package com.java2s; //License from project: Open Source License public class Main { public static <T> Object[][] toObjectArraySquareMatrix(T[][] matrixT) { int size = matrixT.length; Object[][] arObj = new Object[size][size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { arObj[i][j] = (Object) matrixT[i][j]; }//from w w w.ja v a 2 s. c o m } return arObj; } }