The bond order of B2 is 3 and that of B2 is 1. The higher the bond order, the shorter the bond length.