public static boolean addressesAreEqual(String host1,String host2){
  try {
    HostAddress host1Address=getByName(host1);
    HostAddress host2Address=getByName(host2);
    byte[] host1Raw=host1Address.getAddress();
    byte[] host2Raw=host2Address.getAddress();
    for (int octet=0; octet < 4; octet++) {
      if (host1Raw[octet] != host2Raw[octet])       return false;
    }
    return true;
  }
 catch (  Exception e) {
    CLUtils.println(String.format("addressesAreEqual(%s, %s) returns FALSE, Exception=%s",host1,host2,e));
    return false;
  }
}

public static boolean addressesAreEqual ( String host1 , String host2 ) { try { HostAddress host1Address = getByName ( host1 ) ; HostAddress host2Address = getByName ( host2 ) ; byte [ ] host1Raw = host1Address . getAddress ( ) ; byte [ ] host2Raw = host2Address . getAddress ( ) ; for ( int octet = 0 ; octet < 4 ; octet ++ ) { if ( host1Raw [ octet ] != host2Raw [ octet ] ) return false ; } return true ; } catch ( Exception e ) { CLUtils . println ( String . format ( "addressesAreEqual(%s, %s) returns FALSE, Exception=%s" , host1 , host2 , e ) ) ; return false ; } }
this method returns true if the host addresses are equal to each other , otherwise false .
