If there are an odd number of elements in the array, return the element in the middle of the array. code example
Example: If there are an odd number of elements in the array, return the element in the middle of the array.
public String middleElement(String[] array)
{
if (array.length >=1){
if (array.length %2 != 0){
return array[array.length/2];
}
else if(array.length %2 == 0){
return array[array.length/2];
}
return "";
}
else return "";
}