@@ -0,0 +1,1177 @@
+public class LeetCode0566 %7B%0A    public int%5B%5D%5B%5D matrixReshape(int%5B%5D%5B%5D nums, int r, int c)%0A    %7B%0A%0A        if (nums == null %7C%7C nums.length == 0 %7C%7C nums%5B0%5D.length == 0) %7B%0A            return nums;%0A        %7D%0A        int rowLength = nums.length;%0A        int colLength = nums%5B0%5D.length;%0A%0A        int index = rowLength * colLength - 1;%0A%0A        if (r * c - 1 != index) %7B%0A            return nums;%0A        %7D%0A%0A        int%5B%5D%5B%5D result = new int%5Br%5D%5Bc%5D;%0A%0A        for (int i = r - 1; i %3E= 0; i--) %7B%0A            for (int j = c - 1; j %3E= 0; j--) %7B%0A                int row = index / colLength;%0A                int col = index %25 colLength;%0A                result%5Bi%5D%5Bj%5D = nums%5Brow%5D%5Bcol%5D;%0A                index--;%0A            %7D%0A        %7D%0A%0A        return result;%0A    %7D%0A%0A    public static void main(String%5B%5D args)%0A    %7B%0A        LeetCode0566 leetcode = new LeetCode0566();%0A        int%5B%5D%5B%5D nums = %7B %7B 1, 2, 3, 4 %7D %7D;%0A        int%5B%5D%5B%5D result = leetcode.matrixReshape(nums, 2, 2);%0A        for (int i = 0; i %3C result.length; i++) %7B%0A            for (int j = 0; j %3C result%5B0%5D.length; j++) %7B%0A                System.out.print(result%5Bi%5D%5Bj%5D + %22 %22);%0A            %7D%0A            System.out.println();%0A        %7D%0A    %7D%0A%7D

Add LeetCOde0566.java