<awangdev>Reshape the Matrix_1.java
public int[][] matrixReshape(int[][] nums, int r, int c) {
        int totalElements = nums.length * nums[0].length;
        if (totalElements != r * c || totalElements % r != 0) {
            return nums;
        }
        final int[][] result = new int[r][c];
        int newR = 0;
        int newC = 0;
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums[i].length; j++) {
                result[newR][newC] = nums[i][j];
                newC++;
                if (newC == c) {
                    newC = 0;
                    newR++;
                }
            }
        }
        return result;
    }
public int [ ] [ ] sample_funcname ( int [ ] [ ] var_0 , int var_1 , int var_2 ) {
  int var_5 = var_0 . length * var_0 [ 0 ] . length ;
  if ( var_5 != var_1 * var_2 || var_5 % var_1 != 0 ) {
    return var_0 ;
  }
  final int [ ] [ ] var_6 = new int [ var_1 ] [ var_2 ] ;
  int var_7 = 0 ;
  int var_8 = 0 ;
  for ( int var_9 = 0 ;
  var_9 < var_0 . length ;
  var_9 ++ ) {
    for ( int var_10 = 0 ;
    var_10 < var_0 [ var_9 ] . length ;
    var_10 ++ ) {
      var_6 [ var_7 ] [ var_8 ] = var_0 [ var_9 ] [ var_10 ] ;
      var_8 ++ ;
      if ( var_8 == var_2 ) {
        var_8 = 0 ;
        var_7 ++ ;
      }
    }
  }
  return var_6 ;
}
