@Test public void testToBase32() { hash.bits = 0x6ff0414000000000l; hash.significantBits = 25; String base32 = hash.toBase32(); assertEquals("ezs42", base32); }
public String toBase32() { if (significantBits % 5 != 0) { return ""; } StringBuilder buf = new StringBuilder(); long firstFiveBitsMask = 0xf800000000000000l; long bitsCopy = bits; int partialChunks = (int) Math.ceil(((double) significantBits / 5)); for (int i = 0; i < partialChunks; i++) { int pointer = (int) ((bitsCopy & firstFiveBitsMask) >>> 59); buf.append(base32[pointer]); bitsCopy <<= 5; } return buf.toString(); }
GeoHash implements Comparable<GeoHash>, Serializable { public String toBase32() { if (significantBits % 5 != 0) { return ""; } StringBuilder buf = new StringBuilder(); long firstFiveBitsMask = 0xf800000000000000l; long bitsCopy = bits; int partialChunks = (int) Math.ceil(((double) significantBits / 5)); for (int i = 0; i < partialChunks; i++) { int pointer = (int) ((bitsCopy & firstFiveBitsMask) >>> 59); buf.append(base32[pointer]); bitsCopy <<= 5; } return buf.toString(); } }
GeoHash implements Comparable<GeoHash>, Serializable { public String toBase32() { if (significantBits % 5 != 0) { return ""; } StringBuilder buf = new StringBuilder(); long firstFiveBitsMask = 0xf800000000000000l; long bitsCopy = bits; int partialChunks = (int) Math.ceil(((double) significantBits / 5)); for (int i = 0; i < partialChunks; i++) { int pointer = (int) ((bitsCopy & firstFiveBitsMask) >>> 59); buf.append(base32[pointer]); bitsCopy <<= 5; } return buf.toString(); } protected  GeoHash(); private  GeoHash(double latitude, double longitude, int desiredPrecision); }
GeoHash implements Comparable<GeoHash>, Serializable { public String toBase32() { if (significantBits % 5 != 0) { return ""; } StringBuilder buf = new StringBuilder(); long firstFiveBitsMask = 0xf800000000000000l; long bitsCopy = bits; int partialChunks = (int) Math.ceil(((double) significantBits / 5)); for (int i = 0; i < partialChunks; i++) { int pointer = (int) ((bitsCopy & firstFiveBitsMask) >>> 59); buf.append(base32[pointer]); bitsCopy <<= 5; } return buf.toString(); } protected  GeoHash(); private  GeoHash(double latitude, double longitude, int desiredPrecision); static void main(String[] args); static int getBitsToShift(int b1, int b2); static GeoHash withUnprecisionOfDistanceInMeter(double centerLat, double centerLong, double distanceInMeter); static GeoHash withCharacterPrecision(double latitude, double longitude, int numberOfCharacters); static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits); static GeoHash fromBinaryString(String binaryString); static GeoHash fromGeohashString(String geohash); static GeoHash fromIntValue(int hashVal); static GeoHash fromLongValue(long hashVal, int significantBits); GeoHash next(int step); GeoHash next(); GeoHash prev(); long ord(); static GeoHash fromOrd(long ord, int significantBits); static long stepsBetween(GeoHash one, GeoHash two); GeoHash[] getAdjacent(); int significantBits(); long longValue(); int intValue(); String toBase32(); boolean within(GeoHash boundingBox); boolean contains(WGS84Point point); WGS84Point getPoint(); WGS84Point getBoundingBoxCenterPoint(); BoundingBox getBoundingBox(); boolean enclosesCircleAroundPoint(WGS84Point point, double radius); GeoHash getNorthernNeighbour(); GeoHash getSouthernNeighbour(); GeoHash getEasternNeighbour(); GeoHash getWesternNeighbour(); @Override String toString(); String toBinaryString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(GeoHash o); static double distFromInMeter(double lat1, double lng1, double lat2, double lng2); }
GeoHash implements Comparable<GeoHash>, Serializable { public String toBase32() { if (significantBits % 5 != 0) { return ""; } StringBuilder buf = new StringBuilder(); long firstFiveBitsMask = 0xf800000000000000l; long bitsCopy = bits; int partialChunks = (int) Math.ceil(((double) significantBits / 5)); for (int i = 0; i < partialChunks; i++) { int pointer = (int) ((bitsCopy & firstFiveBitsMask) >>> 59); buf.append(base32[pointer]); bitsCopy <<= 5; } return buf.toString(); } protected  GeoHash(); private  GeoHash(double latitude, double longitude, int desiredPrecision); static void main(String[] args); static int getBitsToShift(int b1, int b2); static GeoHash withUnprecisionOfDistanceInMeter(double centerLat, double centerLong, double distanceInMeter); static GeoHash withCharacterPrecision(double latitude, double longitude, int numberOfCharacters); static GeoHash withBitPrecision(double latitude, double longitude, int numberOfBits); static GeoHash fromBinaryString(String binaryString); static GeoHash fromGeohashString(String geohash); static GeoHash fromIntValue(int hashVal); static GeoHash fromLongValue(long hashVal, int significantBits); GeoHash next(int step); GeoHash next(); GeoHash prev(); long ord(); static GeoHash fromOrd(long ord, int significantBits); static long stepsBetween(GeoHash one, GeoHash two); GeoHash[] getAdjacent(); int significantBits(); long longValue(); int intValue(); String toBase32(); boolean within(GeoHash boundingBox); boolean contains(WGS84Point point); WGS84Point getPoint(); WGS84Point getBoundingBoxCenterPoint(); BoundingBox getBoundingBox(); boolean enclosesCircleAroundPoint(WGS84Point point, double radius); GeoHash getNorthernNeighbour(); GeoHash getSouthernNeighbour(); GeoHash getEasternNeighbour(); GeoHash getWesternNeighbour(); @Override String toString(); String toBinaryString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(GeoHash o); static double distFromInMeter(double lat1, double lng1, double lat2, double lng2); static final long FIRST_BIT_FLAGGED; }