private static boolean surroundingInt(int[][] mapToCheck, int intToCheckFor, int cellX, int cellY,
                                        int range) {

    for (int i = -range; i <= range; i++) {
      for (int j = -range; j <= range; j++) {

        int checkX = cellX + i;
        int checkY = cellY + j;

        if (checkX >= 0 && checkX < mapToCheck.length && checkY >= 0
            && checkY < mapToCheck[0].length // Not outside an edge
            && (i != 0 || j != 0) // Not on the cell itself
            && mapToCheck[checkX][checkY] == intToCheckFor) { // Cell is the one we're looking for
          return true;
        }
      }
    }

    return false;
  }