private static int getTypeNeighbors(int[][] tileMap, int x, int y, int max, int min) {
        int resultType = 4;
        int maxCount = 0;
        int grassCount = getCountNeighbors(tileMap, x, y, MyTile.GRASS);
        int grass2Count = getCountNeighbors(tileMap, x, y, MyTile.FOREST_GRASS);
        int dirtCount = getCountNeighbors(tileMap, x, y, MyTile.DIRT);
        int stoneCount = getCountNeighbors(tileMap, x, y, MyTile.STONE);
        int waterCount = getCountNeighbors(tileMap, x, y, MyTile.WATER);
        if (maxCount < grassCount) {
            maxCount = grassCount;
            resultType = MyTile.GRASS;
        }
        if (maxCount < grass2Count) {
            maxCount = grass2Count;
            resultType = MyTile.FOREST_GRASS;
        }
        if (maxCount < dirtCount) {
            maxCount = dirtCount;
            resultType = MyTile.DIRT;
        }
        if (maxCount < stoneCount) {
            maxCount = stoneCount;
            resultType = MyTile.STONE;
        }
        if (maxCount < waterCount) {
            maxCount = waterCount;
            resultType = MyTile.WATER;
        }
        if (maxCount < min) {
            return tileMap[x][y];
        } else if (maxCount >= max) {
            return (int) (Math.random() * 5);
        } else {
            return resultType;
        }

        //  return getCountNeighbors(tileMap, x, y, type);
    }