Imagine you have two points in 2d space and you need to rotate one of these points by X degrees with the other point acting as a center.
float distX = Math.a
Assuming you are usign the Java Graphics2D API, try this code -
Point2D result = new Point2D.Double();
AffineTransform rotation = new AffineTransform();
double angleInRadians = (angle * Math.PI / 180);
rotation.rotate(angleInRadians, pivot.getX(), pivot.getY());
rotation.transform(point, result);
return result;
where pivot is the point you are rotating around.