Consider for exemple selection of days of the week, where we can select one day, several days or nothing.
I am trying to store that data as follows:
public static final int NONE = 0b0000000;
public static final int MONDAY = 0b0000001;
public static final int TUESDAY = 0b0000010;
public static final int WEDNESDAY = 0b0000100;
public static final int THURSDAY = 0b0001000;
public static final int FRIDAY = 0b0010000;
public static final int SATURDAY = 0b0100000;
public static final int SUNDAY = 0b1000000;
where 0
is NONE, 11
is MONDAY and TUESDAY, 1000011
is MONDAY, TUESDAY and SUNDAY;
Is there a way, I can write the same in more readable manner?
Edit: Usage of enums
has decent performans penalties in dalvik ( android jvm), please do not sugget them.