package array1;

import java.util.Arrays;

/*
 * Start with 2 int arrays, a and b, each length 2. Consider the sum of the
 * values in each array. Return the array which has the largest sum. In event of
 * a tie, return a.
 * 
 * biggerTwo({1, 2}, {3, 4}) --> {3, 4}
 * biggerTwo({3, 4}, {1, 2}) --> {3, 4}
 * biggerTwo({1, 1}, {1, 2}) --> {1, 2}
 */
public class BiggerTwoTest {

	public static void main(String[] args) {
		BiggerTwoTest test = new BiggerTwoTest();
		System.out.println(Arrays.toString(test.biggerTwo(
			new int[] {1, 2}, new int[] {3, 4})));
		System.out.println(Arrays.toString(test.biggerTwo(
			new int[] {3, 4}, new int[] {1, 2})));
		System.out.println(Arrays.toString(test.biggerTwo(
			new int[] {1, 1}, new int[] {1, 2})));
	}
	
	public int[] biggerTwo(int[] a, int[] b) {
		  int totalA = 0;
		  int totalB = 0;
		  
		  totalA = a[0] + a[1];
		  totalB = b[0] + b[1];
		  
		  if (totalA >= totalB) {
		    return a;
		  } else {
		    return b;
		  }
		}
}
@@ -374,17 +374,20 @@
 Test %7B%0A%0A
-%09
+    
 public s
@@ -419,17 +419,16 @@
 args) %7B%0A
-%09
 %09BiggerT
@@ -462,17 +462,16 @@
 Test();%0A
-%09
 %09System.
@@ -507,34 +507,36 @@
 est.biggerTwo(%0A%09
-%09%09
+    
 new int%5B%5D %7B1, 2%7D
@@ -554,25 +554,24 @@
  %7B3, 4%7D)));%0A
-%09
 %09System.out.
@@ -603,34 +603,36 @@
 est.biggerTwo(%0A%09
-%09%09
+    
 new int%5B%5D %7B3, 4%7D
@@ -654,17 +654,16 @@
  2%7D)));%0A
-%09
 %09System.
@@ -707,18 +707,20 @@
 erTwo(%0A%09
-%09%09
+    
 new int%5B
@@ -754,14 +754,20 @@
 ));%0A
-%09%7D%0A%09%0A%09
+    %7D%0A%09%0A    
 publ
@@ -805,17 +805,16 @@
 %5B%5D b) %7B%0A
-%09
 %09  int t
@@ -824,17 +824,16 @@
 lA = 0;%0A
-%09
 %09  int t
@@ -848,17 +848,16 @@
 0;%0A%09%09  %0A
-%09
 %09  total
@@ -873,17 +873,16 @@
 + a%5B1%5D;%0A
-%09
 %09  total
@@ -903,17 +903,16 @@
 %5D;%0A%09%09  %0A
-%09
 %09  if (t
@@ -930,18 +930,26 @@
 talB) %7B%0A
-%09%09
+          
     retu
@@ -954,17 +954,16 @@
 turn a;%0A
-%09
 %09  %7D els
@@ -967,17 +967,18 @@
 else %7B%0A%09
-%09
+  
     retu
@@ -987,15 +987,17 @@
  b;%0A
-%09
 %09  %7D%0A
-%09%09
+    
 %7D%0A%7D
+%0A

Update BiggerTwoTest.java