Combine enum values to retrieve corresponding enum strings.
Consider the following scenario:
enum EnumDays {
NONE = 0,
SUN = 1,
MON = 2,
TUE = 4,
WED = 8,
THU = 16,
FRI = 32,
SAT = 64,
ALL = 127
}
If I pass a value of 5, which represents SUN & TUE (1 + 4 = 5).
I intend to receive "SUN" & "TUE" as the output. How can this be achieved?