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[] mercatorToTiles(double[] e) {
        double d = Math.round((20037508.342789 + e[0]) * 53.5865938),
                f = Math.round((20037508.342789 - e[1]) * 53.5865938);
        d = boundaryRestrict(d, 0, 2147483647);
        f = boundaryRestrict(f, 0, 2147483647);
        return new double[] { d, f };
    }

    private static double boundaryRestrict(double f, double e, double d) {
        return Math.max(Math.min(f, d), e);
    }
}