public static final long longEncode(final String hash){
  int level=hash.length() - 1;
  long b;
  long l=0L;
  for (  char c : hash.toCharArray()) {
    b=(long)(BASE_32_STRING.indexOf(c));
    l|=(b << (level-- * 5));
  }
  return (l << 4) | hash.length();
}

public static final long longEncode ( final String hash ) { int level = hash . length ( ) - 1 ; long b ; long l = 0L ; for ( char c : hash . toCharArray ( ) ) { b = ( long ) ( BASE_32_STRING . indexOf ( c ) ) ; l |= ( b << ( level -- * 5 ) ) ; } return ( l << 4 ) | hash . length ( ) ; }
encode from geohash string to the geohash based long format ( lon / lat interleaved , 4 least significant bits = level )
