private int findNext ( BitSet bits , int value , Calendar calendar , int field , int nextField , List < Integer > lowerOrders ) { int nextValue = bits . nextSetBit ( value ) ; // roll over if needed if ( nextValue == - 1 ) { calendar . add ( nextField , 1 ) ; reset ( calendar , Arrays . asList ( field ) ) ; nextValue = bits . nextSetBit ( 0 ) ; } if ( nextValue != value ) { calendar . set ( field , nextValue ) ; reset ( calendar , lowerOrders ) ; } return nextValue ; }
Search the bits provided for the next set bit after the value provided and reset the calendar .