public void shrink(int x, int y) { int stripCt, stripTotal = y; int pendingLength = x; long tStart, tDuration; for (stripCt = stripTotal; stripCt > 1; stripCt--) { tStart = System.currentTimeMillis(); tDuration = 0; while (tDuration < stripCt * 100) { robot.moveMotor(100, 100); if (Thread.currentThread().isInterrupted()) { robot.moveMotors(0, 0); recover(stripCt, robot.distance()); } tDuration = System.currentTimeMillis() - tStart; } } }