```
public int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
int area = (C - A) * (D - B) + (H - F) * (G - E);
//No overlap
if (A >= G || C <= E || B >= H || D <= F) return area;
//Overlap
int overlap_area = (Math.min(C, G) - Math.max(A, E)) * (Math.min(D, H) - Math.max(F, B));
return area - overlap_area;
}
```