private int countHours ( Integer hours ) { int value = hours . intValue ( ) ; int hoursPerDay = 0 ; int hour = 0 ; while ( value > 0 ) { // Move forward until we find a working hour while ( hour < 24 ) { if ( ( value & 0x1 ) != 0 ) { ++ hoursPerDay ; } value = value >> 1 ; ++ hour ; } } return hoursPerDay ; }
Count the number of working hours in a day based in the integer representation of the working hours .