Skip to content

Instantly share code, notes, and snippets.

@DavidMah
Last active December 14, 2015 05:19
Show Gist options
  • Select an option

  • Save DavidMah/5034459 to your computer and use it in GitHub Desktop.

Select an option

Save DavidMah/5034459 to your computer and use it in GitHub Desktop.
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