The Java Math.atan2 (arctangent2) method can be used.
Math.atan2(centerY - myY, centerX - myX) computes the angles shown below. The angles will always be measured from the same horizontal base. Clockwise angles will be negative, and counterclockwise angles will be positive. Math.atan2–like most Java trig functions that return angles–returns an angle in radians. The radians angle has to be converted to a degrees angle.
The angles returned by Math.atan2 have to be converted to angles that can be used by Robots.
(Click each image for a larger view.)
(Angle from Math.atan2 is +51 degrees. Target angle from CenterBot to center x, y is +39 degrees.)
(Angle from Math.atan2 is -38.1 degrees. Target angle from CenterBot to center x, y is +128.1 degrees.)
(Angle from Math.atan2 is -167.4 degrees. Target angle from CenterBot to center x, y is +257.4 degrees.)
(Angle from Math.atan2 is +151.1 degrees. Target angle from CenterBot to center x, y is -61.1 or +298.9 degrees.)
See the CenterBot3 template.