public class ArrayMain {


  // Write a static method addArray that takes two arrays of integers
  // base and toAdd, and _changes_ the base by adding each corresponding
  // index of toAdd to the value already in base.  There is no return
  // value.
  // ASSUME: base and toAdd are the same length.
  public static void addArray(int[] base, int[] toAdd) {
    int[] added = new int[base.length];
    for(int i = 0; i < base.length; i += 1) {
      added[i] = base[i] + toAdd[i];
    }
    base = added;
  }

  public static void printArray(int[] arr) {
    for(int i = 0; i < arr.length; i += 1) {
      System.out.print(arr[i] + ",");
    }
  }

  public static void main(String[] args) {
    
    int[] arr = new int[5];
    arr[0] = 27; arr[1] = 14; arr[2] = 7; arr[3] = 1; arr[4] = 2;
    int[] arr2 = {2, 4, 6, 8};
    int[] arr3 = {3, 4, 5, 6};

    addArray(arr2, arr3);

    System.out.print("arr2: ");
    printArray(arr2);
    System.out.println();
    System.out.println(arr2);
    System.out.println("arr3: " + arr3[0] + " " + arr3[1]);



    /*
    int[] oneElt = new int[1];
    int[] zeroElt = new int[0];

    oneElt[0] = 50;


    System.out.println("Sum is: " + sum(arr));
    System.out.println("Sum is: " + sum(oneElt));
    System.out.println("Sum is: " + sum(zeroElt));
    */

    System.out.println(arr[0] + " " + arr[1] + " " + arr[2]);

    System.out.println("Length is: " + arr.length);

  }










  // Write a static method sum that takes an array of integers
  // and evaluates to the sum of the integers in the array
  /*
  public static int sum(int[] array) {
    int[] total = array;
    for(int i = 0; i < array.length; i += 1) {
      total[i] += array[i];
    }
    return total;
  }
  public static int sum(int[] array) {
    int total = array[0];
    for(int i = 1; i < array.length; i += 1) {
      total += array[i];
    }
    return total;
  }
  public static int sum(int[] array) {
    int total = 0;
    for(int i = 0; i < array.length(); i += 1) {
      total += array[i];
    }
    return total;
  }
  public static int sum(int[] array) {
    int total = 0;
    for(int i = 0; i < array.length; i += 1) {
      total += array[i];
    }
    return total;
  }
  */




















  // Write a static method addArray that takes two arrays of integers
  // base and toAdd, and _changes_ the base by adding each corresponding
  // index of toAdd to the value already in base.  There is no return
  // value.
  // ASSUME: base and toAdd are the same length.



/*
  public static int sum(int[] array) {
    int[] total = array;
    for(int i = 0; i < array.length; i += 1) {
      total[i] += array[i];
    }
    return total;
  }
  public static int sum(int[] array) {
    int total = array[0];
    for(int i = 1; i < array.length(); i += 1) {
      total += array[i];
    }
    return total;
  }
  public static int sum(int[] array) {
    int total = 0;
    for(int i = 0; i < array.length(); i += 1) {
      total += array[i];
    }
    return total;
  }
  public static int sum(int[] array) {
    int total = 0;
    for(int i = 0; i < array.length; i += 1) {
      total += array[i];
    }
    return total;
  }



*/

/*

  public static void addArray(int[] base, int[] toAdd) {
    int[] added = new int[base.length];
    for(int i = 0; i < base.length; i += 1) {
      added[i] = base[i] + toAdd[i];
    }
    base = added;
  }
  public static void addArray(int[] base, int[] toAdd) {
    int[] added = base;
    for(int i = 0; i < base.length; i += 1) {
      added[i] = base[i] + toAdd[i];
    }
  }
  public static void addArray(int[] base, int[] toAdd) {
    for(int i = 0; i < base.length; i += 1) {
      base[i] = base[i] + toAdd[i];
    }
  }
  public static void addArray(int[] base, int[] toAdd) {
    for(int i = 0; i < toAdd.length; i += 1) {
      toAdd[i] = base[i] + toAdd[i];
    }
  }

*/
}
