public static CidrBlock fromString(String cidr) {
        String[] cidrParts = cidr.split("/");
        if (cidrParts.length != 2)
            throw new IllegalArgumentException("Invalid CIDR block, expected format to be " +
                    "'<ip address>/<prefix size>', but was '" + cidr + "'");

        InetAddress inetAddress = InetAddresses.forString(cidrParts[0]);
        int prefixSize = Integer.parseInt(cidrParts[1]);

        return new CidrBlock(inetAddress, prefixSize);
    }
@Test
    public void parse_from_string_test() {
        assertEquals(new CidrBlock(InetAddresses.forString("10.0.0.1"), 12), CidrBlock.fromString("10.0.0.1/12"));
        assertEquals(new CidrBlock(InetAddresses.forString("1234:5678::1"), 64), CidrBlock.fromString("1234:5678:0000::1/64"));
    }