int firstEmpty = -1; for (int slot = 0; slot < criticals.length; slot++) { if (criticals[slot] == 0) { firstEmpty = slot; } if (firstEmpty != -1 && criticals[slot] != 0) {  criticals[firstEmpty] = criticals[slot];  criticals[slot] = 0;  slot = firstEmpty; firstEmpty = -1;
for (int x = 0; x < criticals.length; x++) { int firstEmpty = -1; for (int slot = 0; slot < criticals.length; slot++) { if (criticals[slot] == 0) { firstEmpty = slot; } if (firstEmpty != -1 && criticals[slot] != 0) {  criticals[firstEmpty] = criticals[slot];  criticals[slot] = 0;  slot = firstEmpty; firstEmpty = -1; }
    private void compactCriticals(long[] criticals) {        int firstEmpty = -1;        for (int slot = 0; slot < criticals.length; slot++) {            if (criticals[slot] == 0) {                firstEmpty = slot;            }            if (firstEmpty != -1 && criticals[slot] != 0) {                // move this to the first empty slot                criticals[firstEmpty] = criticals[slot];                // mark the old slot empty                criticals[slot] = 0;                // restart just after the moved slot's new location                slot = firstEmpty;                firstEmpty = -1;            }        }    }