// Create your enum enum YourEnum { enum1, enum2, enum3, enum4; public static final YourEnum[] values = values(); } // to get your enum by its ordinal, write this wherever in java YourEnum yourEnum = YourEnum.values[ordinal];