@Override
  public int compare(RegionInfo l, RegionInfo r) {
    long diff = r.getRegionId() - l.getRegionId();
    if (diff < 0) return -1;
    if (diff > 0) return 1;
    return 0;
  }
The following comparator assumes that RegionId from HRegionInfo can represent the age of the
region - larger RegionId means the region is younger. This comparator is used in balanceCluster()
to account for the out-of-band regions which were assigned to the server after some other region
server crashed.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionInfoComparator.java