Getting the highest cost of an item in an aray

Im trying to get a function to set the highest value when i press the 1 key in an aray and also get the lowest value when i press the 2 key i have the values showing up but i cannot figure out how to get the highest and lowest value i have the numbers ranging randomly when the begin play event happens from 0 to 1000