cast to enum in java code example Example: enum java public enum AlertLevel { Undefined(0), Ok(1), Warning(2), Alarm(3); }