title: BigInteger array with loop. Can't add
body: <pre><code>package fibonacci;
  import java.math.BigInteger;
  import java.math.*;
  public class fibo {
           public static void main(String[] args) {
  
               //number of elements to generate in a series
              BigInteger sum;
              BigInteger[] series= new BigInteger[4000000];
  
  
  
             //long[] series = new long[4000000];
  
               //create first 2 series elements
               series[0] = BigInteger.valueOf(1);
               series[1] = BigInteger.valueOf(2);
  
               //create the Fibonacci series and store it in an array
               for(int i=2; i &lt; series.length; i++){
                       series[i] = series[i-1].add(series[i-2]);
                       if (series[i].mod(BigInteger.valueOf(2)) == BigInteger.valueOf(0)){
                     sum = sum.add(series[i]);  //error here
                       }
  
               }
               System.out.println("Fibonacci Series sum " + sum); //error here
  
  
               }
  
      }
  </code></pre>
  
  <p>I am trying to calculate fibonacci's sum of even numbers. What do I need to change here?
  Or should the whole program be rewrited using .subtract?</p>