We got this method as homework assignment. There should be a way to make the method do less comparisons at runtime.
(the method finds the min and max of the array)
Any help would be appreciated.
public void what()
int x = _arr;
int y = _arr;
for (int i=1; i<_arr.length; i++)
if (_arr[i] < x)
x = _arr[i];
else if (_arr[i] > y)
y = _arr[i];
System.out.println (x + " " + y);