static boolean areAdjacent(RegionInfo regionA, RegionInfo regionB) {
    if (regionA == null || regionB == null) {
      throw new IllegalArgumentException("Can't check whether adjacent for null region");
    }
    if (!regionA.getTable().equals(regionB.getTable())) {
      return false;
    }
    RegionInfo a = regionA;
    RegionInfo b = regionB;
    if (Bytes.compareTo(a.getStartKey(), b.getStartKey()) > 0) {
      a = regionB;
      b = regionA;
    }
    return Bytes.equals(a.getEndKey(), b.getStartKey());
  }
Check whether two regions are adjacent; i.e. lies just before or just after in a table.
@return true if two regions are adjacent
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java