I am trying to read the "day" value from native calendar of blackberry,the value is returned as a integer ,which is mapped to a value for each day of the week.The values are like :
- Monday:32768
- tue: 16384
- wed :8192
- thur :4096
- fri :2048
- sat :1024
- sun :65536
I am able to see if the value is mon/tue/wed/thu/fri/sat/sun if the event is occuring for a single day using
if (rule.MONDAY == rule.getInt(rule.DAY_IN_WEEK)) {
System.out.println("occurs monday");
}
rule.getInt(rule.DAY_IN_WEEK)
value is also same as monday value.
Now the issue is, if the events is occuring on two/three or more number of days then
rule.getInt(rule.DAY_IN_WEEK)
returns me a sum of all days selected.
EXAMPLE: if the days are :wed,sat then i get the result as 9216 ,sum of wed+sat ,from this i am not getting to know which are the days the event occurs.
How can i do a permutation/combination of these numbers and get the exact result for 'n' number of days selected.