Beam-foil Studies of Energy Levels and Radiative Lifetimes in Be I and Be II