private NoteLengthEnum shiftNoteLength(NoteLengthEnum lastBeat, double remaining, int change) {
        NoteLengthEnum beat = lastBeat;
        NoteLengthEnum [] allNoteLengths = NoteLengthEnum.values();

        while(change > 0) {
            //if there is a noteLength you could increment to...
            if(beat.ordinal() + 1 < allNoteLengths.length){
                NoteLengthEnum potentialBeat = allNoteLengths[beat.ordinal() + 1];
                //...and this note will not block the rest of the measure
                if(canFinishMeasure(remaining, potentialBeat.getRatio())){
                    beat = potentialBeat;
                }
            }
            change--;
        }
        while(change < 0) {
            //if there is a noteLength you could increment to...
            if(beat.ordinal() - 1 >= 0){
                NoteLengthEnum potentialBeat = allNoteLengths[beat.ordinal() - 1];
                //...and this note will not block the rest of the measure
                if(canFinishMeasure(remaining, potentialBeat.getRatio())){
                    beat = potentialBeat;
                }
            }
            change++;
        }

        return beat;
    }