Last active
December 14, 2015 05:19
-
-
Save DavidMah/5034459 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FibonacciGenerator { | |
| int previous = 0 | |
| int current = 1 | |
| public int nextNumber() { | |
| int oldCurrent = current; | |
| current = previous + current; | |
| previous = oldCurrent; | |
| return previous; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment