Can someone please help me find a method to this?
The following recursive method addeven (...) is supposed to add the even indexed values of an array, i.e., a[0] + a[2] + a[4] + … There are bugs in the method. Trace the method using test data, find the bugs, and correct them. Be thorough. The method may work on some data sets. (Hint: The error involves one line of code>)
public static int addeven(int a[], int size)
{
if (size == 2)
return a[1];
return a[size - 1] + addeven(a, size - 2) ;
}