Not sure if I understand you correctly but based on question title you may be looking for
YourEnum.valueOf("VALUE").ordinal();
//like Directions.valueOf("NORTH").ordinal();
YourEnum.valueOf("VALUE")returns enum value with name"VALUE"- each enum value knows its position (indexed from zero) which we can get by calling
ordinal()method on it.