Java tutorial
//package com.java2s; public class Main { /** * Calculate the angle to the target location from local. */ private static double getAngle(final double startheight, final double endheight, final float poslength) { double radian = Math.atan(Math.abs((endheight - startheight)) / poslength); double degree = Math.toDegrees(radian); if (startheight > endheight) { return -degree; } return degree; } }