public static int[][] cellularAutomataProcess(int[][] map, int threshold) {
    // FIXME
    int[][] oldMap = copyInt2(map);

    for (int x = 1; x < map.length - 1; x++) {
      for (int y = 1; y < map[0].length - 1; y++) {

        int surroundSum = 0;

        for (int i = -1; i < 2; i++) {
          for (int j = -1; j < 2; j++) {
            if (!(x + i < 0 || x + i > map.length - 1
                  || y + j < 0 || y + j > map[0].length - 1)) {
              surroundSum += oldMap[x + i][y + j];
            }
          }
        }

        if (surroundSum > threshold) {
          map[x][y] = 1;
        }
      }
    }

    return map;
  }