博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java随机3-斐波拉切函数
阅读量:4650 次
发布时间:2019-06-09

本文共 533 字,大约阅读时间需要 1 分钟。

public class FinoIteratorTest {

 private int count;

 public FinoIteratorTest() {

 }

 public FinoIteratorTest(int a) {

  this.count = a;
 }

 public Integer next() {

  return dir(count++);
 }

 private int dir(int i) {

  if (i < 2)
   return 1;
  return dir(i - 1) + dir(i - 2);
 }

 /**

  * @param args
  */
 public static void main(String[] args) {
  FinoIteratorTest finoIteratorTest = new FinoIteratorTest();
  for (int i = 0; i < 5; i++) {
   System.out.println(finoIteratorTest.next());
  }
 }
}

转载于:https://www.cnblogs.com/changweihua/archive/2011/10/24/2223178.html

你可能感兴趣的文章
python pip包安装以及几个包的简单用法
查看>>
浅谈HTTP事务的一个过程
查看>>
数据压缩--蓝桥杯
查看>>
【提示框】【计时事件】【cookie】
查看>>
UVa 四叉树
查看>>
hihoCoder 1116 计算(线段树)
查看>>
支付平台架构
查看>>
客户端下载文件和服务器端下载文件总结
查看>>
批处理定时打开一个网页
查看>>
EBGAN
查看>>
第一天 python入门 基础 “”“Hello World”和if-elif的使用、数据类型
查看>>
think python chapter3
查看>>
源码安装MySQL
查看>>
第八周进度条博客
查看>>
软工项目项目介绍,任务分配--拍桌子版
查看>>
Liferay7 BPM门户开发之27: MVC Portlet插件工程开发
查看>>
麦软社区Mindmanager现金抵用券使用流程
查看>>
教你一些Linux中隐藏bash历史命令的小技巧
查看>>
jquery、datetimepicker插件中的change事件
查看>>
C++ 随机生成一个(0,1)之间的小数
查看>>