//recursive, to find the sum of all elements in an array public class eg39_RangeSum { public static void main(String[] args) { int[] numbers = {0,1,2,3,4,5,6,7,8,9}; int mystart = 1; int myend = 5; System.out.println("The sum of elements "+mystart+" through "+myend+" is " +rangeSum(numbers, mystart, myend)); } public static int rangeSum(int[] array, int start, int end) { System.out.println ("now start = " + start + "; end = "+end); if (start > end) return 0; else return array[start] + rangeSum(array, start+1, end); } }