Here you can find the source of angleInDegrees(float ownerRotation, float x1, float y1, float x2, float y2)
public static float angleInDegrees(float ownerRotation, float x1, float y1, float x2, float y2)
//package com.java2s; //License from project: Apache License public class Main { public static float angleInDegrees(float ownerRotation, float x1, float y1, float x2, float y2) { return Math.abs(ownerRotation - angleInDegrees(x1, y1, x2, y2)) % 360; }//from w w w . j ava2 s. com public static float angleInDegrees(float originX, float originY, float targetX, float targetY) { return (float) Math.toDegrees(Math.atan2(targetY - originY, targetX - originX)); } }