```
public int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
int space =0;
int space1 = (Math.abs(A-C)*Math.abs(B-D));
int space2 =(Math.abs(E-G)*Math.abs(F-H));
//borrowed from anther solution
int left = Math.max(A,E);
int right = Math.min(G,C);
int top = Math.min(D,H);
int bottom = Math.max(B,F);
if (top >= bottom && right >= left) {
space = (Math.abs(bottom-top)*Math.abs(left-right));
}
return space1+space2-space;
}
```