Here you can find the source of calculateAngle(float x, float y, float x1, float y1)
public static float calculateAngle(float x, float y, float x1, float y1)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . j av a 2s.co m*/ * From x,y -> x1,y1 * * @return The value is in radians. */ public static float calculateAngle(float x, float y, float x1, float y1) { double angle = Math.atan2(y - y1, x - x1); return (float) angle + 1.5f; } }