Geobox { public static long getMask(float x, float base, int bits) { return (long) Math.floor(((x + base) / (2 * base)) * (1 << (bits - 1))); }  static long getMask(float x, float base, int bits); static long getHash(float lat, float lng, int bits); static Set<Long> getTuple(float lat, float lng, int bits); static double distance(DLocation p1, DLocation p2); static double makeDoubleInRange(double d); static int getCellSize(int bits); static double getCellSize(int bits, double latitude); static double distance(double p1lat, double p1lon, double p2lat, double p2lon); static final int RADIUS; static final int D; @Deprecated
    static final int BITS_10_39km; @Deprecated
    static final int BITS_12_10km; @Deprecated
    static final int BITS_15_1224m; @Deprecated
    static final int BITS_17_307m; @Deprecated
    static final int BITS_18_154m; @Deprecated
    static final int BITS_19_77m; @Deprecated
    static final int BITS_20_39m; @Deprecated
    static final int BITS_22_10m; @Deprecated
    static final int BITS_23_53dm; @Deprecated
    static final int BITS_24_32dm; static final int BITS_0_40075004m; static final int BITS_1_20037502m; static final int BITS_2_10018751m; static final int BITS_3_5009375m; static final int BITS_4_2504687m; static final int BITS_5_1252343m; static final int BITS_6_626171m; static final int BITS_7_313085m; static final int BITS_8_156542m; static final int BITS_9_78271m; static final int BITS_10_39135m; static final int BITS_11_19567m; static final int BITS_12_9783m; static final int BITS_13_4891m; static final int BITS_14_2445m; static final int BITS_15_1222m; static final int BITS_16_611m; static final int BITS_17_305m; static final int BITS_18_152m; static final int BITS_19_76m; static final int BITS_20_38m; static final int BITS_21_19m; static final int BITS_22_9m; static final int BITS_23_4m; static final int BITS_24_2m; static final int BITS_25_1m; static final int BITS_26_0m; }
@Test public void testSize() { final float lat = 25.18f; for (int bits = 10; bits < 25; bits++) { final long maskLat = Geobox.getMask(lat, 90f, bits); long m = maskLat; float latMin = lat; while (m == maskLat) { latMin -= 0.00001f; m = Geobox.getMask(latMin, 90f, bits); } m = maskLat; float latMax = lat; while (m == maskLat) { latMax += 0.00001f; m = Geobox.getMask(latMax, 90f, bits); } DLocation pMin = new DLocation(latMin, lat); DLocation pMax = new DLocation(latMax, lat); pMin = new DLocation(lat, latMin); pMax = new DLocation(lat, latMax); } }