final SelectedMailbox selected = session.getSelected();
boolean useUids = !msn;
// First of check if we have any messages in the mailbox
// if not we don't need to go through all of this
if (selected.existsCount() > 0) {
for (int i = 0; i < length; i++) {
final IdRange range = sequenceNumbers[i];
long lowVal = range.getLowVal();
long highVal = range.getHighVal();