code: public static String adjacentHash(String hash, Direction direction) {
          checkHash(hash);
          Preconditions.checkArgument(hash.length() > 0,
                  "adjacent has no meaning for a zero length hash that covers the whole world");
  
          String adjacentHashAtBorder = adjacentHashAtBorder(hash, direction);
          if (adjacentHashAtBorder != null)
              return adjacentHashAtBorder;
  
          String source = hash.toLowerCase();
          char lastChar = source.charAt(source.length() - 1);
          Parity parity = (source.length() % 2 == 0) ? Parity.EVEN : Parity.ODD;
          String base = source.substring(0, source.length() - 1);
          if (BORDERS.get(direction).get(parity).indexOf(lastChar) != -1)
              base = adjacentHash(base, direction);
          return base + BASE32.charAt(NEIGHBOURS.get(direction).get(parity).indexOf(lastChar));
      }
docs: Returns the adjacent hash in given {@link Direction}. Based on
  https://github.com/davetroy/geohash-js/blob/master/geohash.js. This
  method is an improvement on the original js method because it works at
  borders too (at the poles and the -180,180 longitude boundaries).
  
  @param hash
  string hash relative to which the adjacent is returned
  @param direction
  direction relative to {@code hash} for which the adjacent is
  returned
  @return hash of adjacent hash