private boolean searchRightWall(int xCoord, int yCoord) {
    boolean rightWall = true;

    int[] lookingDirection = lookingDirection(RIGHT);

    int xLooking = lookingDirection[0];
    int yLooking = lookingDirection[1];

    char[][] map = occupancyMap.getGrid();
    boolean end = false;

    int predictedStepsWall = 0;

    while (predictedStepsWall < 6 && !end) {
      if (map[xCoord][yCoord] == occupancyMap.getUnknown()) {
        end = true;
        rightWall = false;
      } else if (map[xCoord][yCoord] == occupancyMap.getObstacle()) {
        end = true;
        rightWall = true;
      }
      predictedStepsWall++;
      xCoord += xLooking;
      yCoord += yLooking;
    }
    if (!end) {
      rightWall = false;
    }
    return rightWall;
  }
  private void processScan() throws IOException {
    scanInit();

    int xCoord = (int) position[0] / occupancyMap.getCellDimension();
    int yCoord = (int) position[1] / occupancyMap.getCellDimension();

    int[] lookingDirection = lookingDirection(FORWARD);

    int xLooking = lookingDirection[0];
    int yLooking = lookingDirection[1];

    boolean end = false;

    char[][] map = occupancyMap.getGrid();

    int predictedSteps = 0;

    while (predictedSteps < MAX_VIEW && !end) {
      boolean rightWall = searchRightWall(xCoord, yCoord);

      if (rightWall && map[xCoord][yCoord] == occupancyMap.getEmpty()) {
        predictedSteps++;
      } else if (rightWall && map[xCoord][yCoord] == occupancyMap.getUnknown()) {
        moveForward(predictedSteps - 2);
        end = true;
      } else if (rightWall && map[xCoord][yCoord] == occupancyMap.getObstacle()) {
        moveForward(predictedSteps - 3);
        rotate("LEFT");
        end = true;
      } else if (!rightWall && map[xCoord][yCoord] == occupancyMap.getUnknown()) {
        moveForward(predictedSteps - 2);
        end = true;
      } else if (!rightWall && map[xCoord][yCoord] == occupancyMap.getEmpty()) {
        rightCorner(predictedSteps);
        end = true;
      }
      xCoord += xLooking;
      yCoord += yLooking;
    }
    if (!end) {
      moveForward(predictedSteps - 2);
    }
  }