You can check if a cell is infected by taking advantage of short-circuited evaluation:
boolean leftInfected = (i!=0) && myGrid[i-1][j]=='I';
boolean rightInfected = (i!=11) && myGrid[i+1][j]=='I';
boolean topInfected = (j!=0) && myGrid[i][j-1]=='I';
boolean bottomInfected = (j!=11) && myGrid[i][j+1]=='I';
After that, you could check if all four are infected:
if (leftInfected && rightInfected && topInfected && bottomInfected) {
myGrid[i][j] = 'D';
}