Here you can find the source of vectorTolatLonDegrees(double X, double Y, double Z)
public static double[] vectorTolatLonDegrees(double X, double Y, double Z)
//package com.java2s; //License from project: Open Source License public class Main { private static double[] return_coordinates = new double[2]; private static double return_result = 0; public static double[] vectorTolatLonDegrees(double X, double Y, double Z) { // Convert cartesian coordinates back to radians, and radians to degrees return_coordinates[0] = RadsToDegrees(Math.atan2(Y, X)); // Longitude double finalHypotenuse = Math.sqrt(X * X + Y * Y); return_coordinates[1] = RadsToDegrees(Math.atan2(Z, finalHypotenuse)); // Latitude return return_coordinates; }// w ww .j a v a2 s. c om public static double RadsToDegrees(double radians) { return_result = radians * (180 / Math.PI); return return_result; } }