code: public void sortByProximity(final InetAddress address, List<InetAddress> addresses)
      {
          Collections.sort(addresses, new Comparator<InetAddress>()
          {
              public int compare(InetAddress a1, InetAddress a2)
              {
                  return compareEndpoints(address, a1, a2);
              }
          });
      }
docs: Sorts the <tt>List</tt> of node addresses, in-place, by proximity to the given address
  @param address the address to sort the proximity by
  @param addresses the nodes to sort