Hysteresis loop and its relation to the critical current of finite superconducting cylinders