public static < E extends Enum < E > & ByteEnum > E fromByte ( Class < E > eclass , byte code ) { for ( E value : eclass . getEnumConstants ( ) ) { if ( value . toByte ( ) == code ) { return value ; } } throw new IllegalArgumentException ( eclass + " has no value with code " + code ) ; }
Returns the enum value with the specified code in the supplied enum class .