/** * @(#)foldMethod.java * * foldMethod application * * @author Mike Careen * @version 1.00 2007/4/11 */ public class foldMethod { public static int[] fold (int[] numbers) { int[] sum = new int [numbers.length / 2]; for (int i = 0 ; i < sum.length ; i++) { // = i < 4 sum [i] = numbers [i] + numbers [i + sum.length]; // + "numbers" array value "i" + 4 } return sum; // sum is the array thats taken from all this code in method^ } public static void main (String[] args) { int[] nums = {3, 1, 8, 2, 9, 5, 6, 7}; int[] array = fold (nums); //variable that calls the method above and takes the values into its array as calculated for (int i = 0 ; i < array.length ; i++) { //outputs the variable array once everything is calculated within for System.out.println (array [i]); } } }