public boolean equals(Object obj){
  if (this == obj)   return true;
  if (!(obj instanceof IPAddressName))   return false;
  IPAddressName otherName=(IPAddressName)obj;
  byte[] other=otherName.address;
  if (other.length != address.length)   return false;
  if (address.length == 8 || address.length == 32) {
    int maskLen=address.length / 2;
    for (int i=0; i < maskLen; i++) {
      byte maskedThis=(byte)(address[i] & address[i + maskLen]);
      byte maskedOther=(byte)(other[i] & other[i + maskLen]);
      if (maskedThis != maskedOther) {
        return false;
      }
    }
    for (int i=maskLen; i < address.length; i++)     if (address[i] != other[i])     return false;
    return true;
  }
 else {
    return Arrays.equals(other,address);
  }
}

public boolean equals ( Object obj ) { if ( this == obj ) return true ; if ( ! ( obj instanceof IPAddressName ) ) return false ; IPAddressName otherName = ( IPAddressName ) obj ; byte [ ] other = otherName . address ; if ( other . length != address . length ) return false ; if ( address . length == 8 || address . length == 32 ) { int maskLen = address . length / 2 ; for ( int i = 0 ; i < maskLen ; i ++ ) { byte maskedThis = ( byte ) ( address [ i ] & address [ i + maskLen ] ) ; byte maskedOther = ( byte ) ( other [ i ] & other [ i + maskLen ] ) ; if ( maskedThis != maskedOther ) { return false ; } } for ( int i = maskLen ; i < address . length ; i ++ ) if ( address [ i ] != other [ i ] ) return false ; return true ; } else { return Arrays . equals ( other , address ) ; } }
compares this name with another , for equality .
