首页 > 编程语言 > 详细

java递归排序

时间:2018-01-16 19:55:19      阅读:191      评论:0      收藏:0      [点我收藏+]

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);
}
}
}

java递归排序

原文:https://www.cnblogs.com/nizuimeiabc1/p/8298191.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!