private int pickMostLoadedServer(final BalancerClusterState cluster) {
      Integer[] servers = cluster.serverIndicesSortedByRegionCount;
      int index;
      for (index = servers.length - 1; index > 0; index--) {
        if (servers[index] != null) {
          break;
        }
      }
      return servers[index];
    }
Pick favored nodes with the highest locality for a region with lowest locality.
hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java