@@ -0,0 +1,1668 @@
+import java.util.Date;%0Aimport java.util.Random;%0A%0Apublic class Main %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        final int n = 8;%0A        final int m = 5;%0A        int%5B%5D%5B%5D matrix = new int%5Bn%5D%5Bm%5D;%0A%0A        Random rand = new Random(new Date().getTime());%0A        for (int i = 0; i %3C n; i++) %7B%0A            for (int j = 0; j %3C m; j++) %7B%0A                    int value = rand.nextInt(200);%0A                    matrix%5Bi%5D%5Bj%5D = value;%0A            %7D%0A        %7D%0A%0A        System.out.println(%22Original matrix%22);%0A        for (int i = 0; i %3C n; i++) %7B%0A            for (int j = 0; j %3C m; j++) %7B%0A                    System.out.print(matrix%5Bi%5D%5Bj%5D + %22 %22);%0A            %7D%0A            System.out.println();%0A        %7D%0A%0A        int%5B%5D%5B%5D matrix2 = Transpose(matrix,n,m);%0A        System.out.println();%0A        System.out.println(%22Transpose matrix%22);%0A        for (int i = 0; i %3C m; i++) %7B%0A            for (int j = 0; j %3C n; j++) %7B%0A                    System.out.print(matrix2%5Bi%5D%5Bj%5D + %22 %22);%0A%0A            %7D%0A            System.out.println();%0A        %7D%0A%0A        int%5B%5D%5B%5D matrix3 = Transpose(matrix2,m,n);%0A        System.out.println();%0A        System.out.println(%22Double-transpose matrix%22);%0A        for (int i = 0; i %3C n; i++) %7B%0A            for (int j = 0; j %3C m; j++) %7B%0A                System.out.print(matrix3%5Bi%5D%5Bj%5D + %22 %22);%0A%0A            %7D%0A            System.out.println();%0A        %7D%0A%0A    %7D%0A%0A    public static int%5B%5D%5B%5D Transpose(int%5B%5D%5B%5D matrix, int n, int m) %7B%0A        int%5B%5D%5B%5D newmatrix = new int%5Bm%5D%5Bn%5D;%0A        for (int i = 0; i %3C n; i++) %7B%0A            for (int j = 0; j %3C m; j++) %7B%0A                newmatrix%5Bj%5D%5Bi%5D = matrix%5Bi%5D%5Bj%5D;%0A            %7D%0A        %7D%0A            return newmatrix;%0A    %7D%0A%7D%0A

Transpose matrix