public static byte[] inetAddress2Bytes(InetAddress val) {
        if (val == null){
        	return null;
        }
        if (!(val instanceof Inet4Address)) {
            throw new IllegalArgumentException("Adress must be of subclass Inet4Address");
        }
        return val.getAddress();
    }