Create an algorithm to find the maximum value in an array of numbers.
[3, 5, 7, 2]
max = 0
for num in array:
    if num > max:
        max = num
print(max) # Outputs 7
<sys>[INST] Create an algorithm to find the maximum value in an array of numbers. [/INST] Input:
[3, 5, 7, 2] </sys>