move condition to loop
@@ -302,7 +302,7 @@ public class NetCDFImportTask extends AbstractTask {
if (scanStartPositions[i] < 0) {
// Yes, find nearest present scan
int nearestI = Integer.MAX_VALUE;
- for (int j = 1; 1 < 2; j++) {
+ for (int j = 1; (i + j) < totalScans || (i - j) >= 0; j++) {
if ((i + j) < totalScans) {
if (scanStartPositions[i + j] >= 0) {
nearestI = i + j;
@@ -315,11 +315,6 @@ public class NetCDFImportTask extends AbstractTask {
break;
}
}
-
- // Out of bounds?
- if (((i + j) >= totalScans) && ((i - j) < 0)) {
- break;
- }
}
if (nearestI != Integer.MAX_VALUE) {
