Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static double[] mercatorToGeo(double[] e) {
        double j = Math.PI, f = j / 2, i = 6378137, n = 0.003356551468879694, k = 0.00000657187271079536,
                h = 1.764564338702e-8, m = 5.328478445e-11;
        double g = f - 2 * Math.atan(1 / Math.exp(e[1] / i));
        double l = g + n * Math.sin(2 * g) + k * Math.sin(4 * g) + h * Math.sin(6 * g) + m * Math.sin(8 * g);
        double d = e[0] / i;
        return new double[] { d * 180 / Math.PI, l * 180 / Math.PI };
    }
}