title: Java days of week calculation
body: <p>I have an Enum for Days of week (with Everyday, weekend and weekdays) as follows where each entry has an int value. </p>
  
  <pre><code>public enum DaysOfWeek {
  
  
    Everyday(127),
    Weekend(65),
    Weekdays(62), 
    Monday(2),
    Tuesday(4),
    Wednesday(8),
    Thursday(16),
    Friday(32), 
    Saturday(64),
    Sunday(1);
  
    private int bitValue;
  
    private DaysOfWeek(int n){
      this.bitValue = n;
    }
  
    public int getBitValue(){
      return this.bitValue;
    }
  }
  </code></pre>
  
  <p>Given a TOTAL of any combination of the values, what would be the simplest way to calculate all individual values and make an arraylist from it. For example given the number 56 (i.e. Wed+Thur+Fri), how to calculate the days.</p>