java递归排序

public class TestNativeOutOfMemoryError
{
static int[] aa = new int[] {1, 2, 3, 4};

static int[] bb = new int[aa.length];

public static void main(String[] args)
{
getArray(0);
for (int i = 0; i < bb.length; i++)
System.out.println(bb[i]);

}

/**
* 递归算法,把整形数组逆序输出
*@Title: getArray
*@Description: TODO(这里用一句话描述这个方法的作用)
*@Author: Administrator
*@Since: 2018年1月16日下午6:41:05
*@param: @param index递归算法起始位置
*@return void
*/
static void getArray(int index)
{
while (index < aa.length)
{
bb[index] = aa[aa.length - 1 - index];
index++;
getArray(index);
}
}
}

posted @ 2018-01-16 18:40  ppjj  阅读(440)  评论(0编辑  收藏  举报