话不多说,直接上代码
1 /** 2 * Created with IntelliJ IDEA 3 * Created By chump 4 * Date: 2017/7/3 5 * Time: 9:27 6 */ 7 /** 8 * 输入一个初始值,矩阵行,矩阵列,根据初始值构建矩阵,求出转置矩阵,最后求出矩阵的乘积返回 9 * 如:输入1,3,3可构建矩阵10 * 1 2 311 * 4 5 612 * 7 8 913 * 转置矩阵为14 * 1 4 715 * 2 5 816 * 3 6 917 */18 public class MatrixProduct {19 public static void main(String []args){20 MatrixProduct matrixProduct = new MatrixProduct();21 matrixProduct.Matrix(1,3,3);22 }23 public int [][] Matrix(int initValue,int rows,int columns){24 int init = initValue; //初始值25 int row = rows ; //行26 int column = columns; //列27 //初始化矩阵28 int [][]matrixOriginal = new int[row][column];29 for(int i=0;i