Hydrogen has one valence electron, and bromine has seven valence electrons. In order to achieve a stable electron configuration, hydrogen needs to gain one electron, and bromine needs to gain one electron. This can be achieved by forming a covalent bond, where the two atoms share their electrons.