title: Java Recursion to find MAX sum in array
body: <p>I am trying to figure out a solution to calculate the highest sum of numbers in an array. However, my limitation is that I cannot use adjacent values in the array.</p>
  
  <p>If I am given the array <code>int [] blocks = new int[] {15, 3, 6, 17, 2, 1, 20};</code> the highest sum calculated is 52 (15+17+20).
  My goal is to go from a recursive solution to a solution that uses dynamic programming, however, I am having trouble with the recursive solution.</p>
  
  <p>The base cases that I have initialized:</p>
  
  <pre><code>if(array.length == 0)
      return 0;
  if(array.length == 1)
      return array[0];
  </code></pre>
  
  <p>After creating the base cases, I am unsure of how to continue the recursive process. 
  I initially tried to say that if the <code>array</code> was of certain length, then I can calculate the max(<code>Math.max</code>) of the calculations:
  e.g. <code>if array.length = 3
                    return Math.max(array[0], array[1], array[2], array[0]+ array[2])</code> </p>
  
  <p>The problem I then run into is that I could be given an array of length 100.
  How can I use recursion in this problem?</p>