Problem Statement  
My partner and I have bags of gold, lined up in a row. The bags are different
sizes. My partner has offered to split up the gold using the following system:
we take turns, each time choosing one bag from either end of the line. She
has even generously offered to let me go first  hmmmmmmmm....
I need software to tell me the total amount of gold that I will get compared to how much my partner will get if I choose first. Of course we will assume that my partner and I are brilliant and always choose in the optimum way. Create a class BagsOfGold that contains a method netGain that is given a int[] bags, the values of all the bags of gold in the order in which they are lined up. It should return how much more gold I will get than my partner if we both behave optimally. (I fear that the answer might be a negative number since my partner proposed the plan.)  
Definition  
 
Constraints  
  bags will contain between 1 and 50 elements inclusive.  
  Each element of bags will be between 1 and 100,000 inclusive.  
Examples  
0)  
 
1)  
 
2)  
 
3)  
