I would recommend using values().length. This is far more elegant and the performance overhead versus using a constant will be negligable. Also, you eliminate the risk of the constant ever becoming out of step with the actual length of the enumeration.