if (length == 1) {
return;
}
NSArray rearrangedArray = new NSArray(length);
NSNumber defaultDevice = null;
int index = putDefaultFirst ? 1 : 0;
for (int i = 0; i < length; i++) {
NSNumber d = (NSNumber) devices.objectAtIndex(i);
if (d.intValue() == device.getDeviceFamily()) {
defaultDevice = d;
} else {
rearrangedArray.setValue(index, d);
index++;
}