Math.atan2 should do the job

EDIT:
I'm lazy, and my reply suggests it aswell. I'm going to give you more than just that little hint: The source code I used to calculate the velocities of a projectile shot form the player.
1 2 3 4 5 6 7 8
| Shot shot = new Shot(player.getX(), player.getY(), player.getRotation()); shot.setXV(shot.getXV() + Math.cos(Math.toRadians(player.getRotation())) * GameMain.shotSpeed + player.getXVelocity()); shot.setYV(shot.getYV() + Math.sin(Math.toRadians(player.getRotation())) * GameMain.shotSpeed + player.getYVelocity()); |
It should be pretty selfexplainatory. The angle was entered in radians, and is normally in degress for my convinience.

Cheers!
