In your findCircle method,
if(pixels[i1][j1] != pixels[i1+r][j1]
|| pixels[i1][j1] != pixels[i1-r][j1]
|| pixels[i1][j1] != pixels[i1][j1+r]
|| pixels[i1][j1] != pixels[i1][j1-r]){
drawCircle(i1,j1,r,img,g2);
}
If r is anything but 0 this will cause an array index out of bounds exception since you're basically looping from the 0th to the nth index. Basically anywhere you're adding or subtracting r. For example, this is one of the statements that will cause this error
pixels[i1+r][j1]