Write a function to find the maximum value in an array of integers.
Implement find_max(nums), which accepts a non-empty list of integers and returns the largest integer. Do not use Python's built-in max() function. The function should correctly handle negative values and duplicate maximum values.
def find_max(nums):