private static double getAngle(int x1,int y1, int x2,int y2) { int dx = x2 - x1; int dy = y2 - y1; double rad= Math.atan2(dx, dy); double degree = (rad*180)/Math.PI ; return degree; }