Here you can find the source of angleTo(final int x, final int y, final int thatx, final int thaty)
public static float angleTo(final int x, final int y, final int thatx, final int thaty)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w.j a va2 s. co m*/ * Returns the angle between this point and that point. * * @return the angle in radians (between -pi and pi) between this point and that point (0 if equal) */ public static float angleTo(final int x, final int y, final int thatx, final int thaty) { final int dx = thatx - x; final int dy = thaty - y; return (float) Math.atan2(dy, dx); } }