title: How to create Fibonacci Sequence in Java
body: <p>I really suck at math. I mean, I REALLY suck at math. 
  I'm trying to make a simple fibonacci sequence class for an algorithm I'll be using. I have seen the python example which looks something like this:</p>
  
  <pre><code>a = 0
  b = 1
  while b &lt; 10:
      print b
      a, b = b, b+a
  </code></pre>
  
  <p>The problem is that I can't really make this work in any other language. I'd like to make it work in Java, since I can pretty much translate it into the other languages I use from there. This is the general thought:</p>
  
  <pre><code>    public class FibonacciAlgorithm {
  
      private Integer a = 0;
  
      private Integer b = 1;
  
      public FibonacciAlgorithm() {
  
      }
  
      public Integer increment() {
          a = b;
          b = a + b;
          return value;
      }
  
      public Integer getValue() {
          return b;
      }
  }
  </code></pre>
  
  <p>All that I end up with is doubling, which I could do with multiplication :(
  Can anyone help me out? Math pwns me. </p>