find maximum or minimum value in a numeric array in java solution