MergeSort { public int maxBenefit(int[] benefits, int low, int mid, int high) { int leftSum = 0; int sum1 = 0; for (int i = mid; i >= low; i--) { sum1 += benefits[i]; if (sum1 > leftSum) { leftSum = sum1; } } int rightSum = 0; int sum2 = 0; for (int j = mid + 1; j <= high; j++) { sum2 = sum2 + benefits[j]; if (sum2 > rightSum) { rightSum = sum2; } } return leftSum + rightSum; }  int[] transfer(int[] benefits); int maxBenefit(int[] benefits, int low, int mid, int high); int findMaximum(int[] benefits, int low, int high);  }
@Test public void testMaxBenefit() { int[] transferred = {13, -3, -25, 20, -3, -16, -23, 18, 20, -7, 12, -5, -22, 15, -4, 7}; int len = transferred.length; int max = mergeSort.maxBenefit(transferred, 0, (len / 2), len - 1); assertEquals(43, max); }