---
title: "【转】数组行列递归转换"
author: "foohsinglong"
date: "2011-09-16T13:54:47Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2011-09-16T13:54:47Z"
id: 1173401
url: "https://foohsinglong.iteye.com/blog/1173401"
---

```java
static void populateArray(int minValue, int rowNum, int colNum, int[][] toBePopulatedArray) {  
        for (int colIdx = 0; colIdx < colNum; colIdx++) {  
            toBePopulatedArray[0][colidx] = minValue++;  
        }  
          
        //Recursive population  
        if (rowNum > 1 || colNum > 1) {  
              
            int newRowNum = colNum;  
            int newcolNum = rowNum - 1;  
            int[][] subArray = new int[newrownum][newcolnum];  
              
            populateArray(minValue, newRowNum, newcolNum, subArray);  
              
            for (int colIdx = colNum - 1; colIdx > -1; colIdx--) {  
                for (int rowIdx = 1; rowIdx < rowNum; rowIdx++) {  
                    toBePopulatedArray[rowidx][colidx] = subArray[newrownum - colidx - 1][rowidx - 1];  
                }  
            }  
        }  
    }  
```