I'm not really sure what are you trying to achieve, but isn't it easier to just use the atan2 function to get an angle?
http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#atan2(double, double)
If you are not familiar with the function you can read here:
http://en.wikipedia.org/wiki/Atan2
Edit, code example:
So, here is some code I think that is useful, after the discussion
public static double getAngle(int x, int y)
{
return 1.5 * Math.PI - Math.atan2(y,x); //note the atan2 call, the order of paramers is y then x
}
Basically, it calculates an angle between the negative Y-axis with the positive clockwise direction. I hope that is what you have been looking for.