public static byte[] encode(InetAddress value){
  byte[] address=value.getAddress();
  if (address.length == 4) {
    byte[] mapped=new byte[16];
    System.arraycopy(IPV4_PREFIX,0,mapped,0,IPV4_PREFIX.length);
    System.arraycopy(address,0,mapped,IPV4_PREFIX.length,address.length);
    address=mapped;
  }
 else   if (address.length != 16) {
    throw new UnsupportedOperationException("Only IPv4 and IPv6 addresses are supported");
  }
  return address;
}

public static byte [ ] encode ( InetAddress value ) { byte [ ] address = value . getAddress ( ) ; if ( address . length == 4 ) { byte [ ] mapped = new byte [ 16 ] ; System . arraycopy ( IPV4_PREFIX , 0 , mapped , 0 , IPV4_PREFIX . length ) ; System . arraycopy ( address , 0 , mapped , IPV4_PREFIX . length , address . length ) ; address = mapped ; } else if ( address . length != 16 ) { throw new UnsupportedOperationException ( "Only IPv4 and IPv6 addresses are supported" ) ; } return address ; }
encode inetaddress value into binary encoding
