What is the formula of rotational energy of diatomic molecule?

Rotational energy of diatomic molecule is given by,
$$E_J = \frac {\hbar ^2}{2I} J( J+1 )$$
Where,
I = Moment of inertia of diatomoc molecule.
J = Rotational quantum number.