When a ball is thrown in an upward direction, its velocity decreases continuously but its potential energy goes on increasing. As the ball reaches to a maximum height, the kinetic energy gradually gets converted into potential energy of the ball. At the highest point where the velocity of the ball becomes zero, the potential energy of the ball becomes maximum. Because all of the kinetic energy gets converted into potential energy.