The following functions has been modified:
public double[] getB(double xm,double ym) : to compute magnetic field at (xm,ym) related to (xMagnet,yMagnet)

in public void computeField () :
     bf1=getB((x-xMagnet)*cs+(y-yMagnet)*sc,-(x-xMagnet)*sc+(y-yMagnet)*cs);//FKH
     bf2=getB((x-xMagnet2)*cs2+(y-yMagnet2)*sc2,-(x-xMagnet2)*sc2+(y-yMagnet2)*cs2);//FKH
// the above two lines calculate field from two magnets
     xField[ i ][j] = lcst*(bf1[0]*cs-bf1[1]*sc)+rcst*(bf2[0]*cs2-bf2[1]*sc2);//FKH
     yField[ i ][j] = lcst*(bf1[0]*sc+bf1[1]*cs)+rcst*(bf2[0]*sc2+bf2[1]*cs2);//FKH
//calculate the sum of magnet field from two magnets
     magField[ i ][j]=Math.sqrt(xField[ i ][j]*xField[ i ][j]+yField[ i ][j]*yField[ i ][j]);