class InetAddressUtils {

    public static InetAddressBlock parse(String text) throws InvalidInetAddressException {
        //TODO(mmarquez): should we validate address format ??
        String[] parts = text.split("/");

        InetAddress address;

        address = InetAddressUtils.getAddressForBan(parts[0]);

        int nbits;

        try {
            nbits = Integer.parseInt(parts[1]);
        }
        catch (NumberFormatException ex) {
            throw new InvalidInetAddressBlockException("Invalid mask", ex);
        }

        if (nbits <= 0 || nbits > address.getAddress().length * 8) {
            throw new InvalidInetAddressBlockException("Invalid mask", null);
        }

        return new InetAddressBlock(address, nbits);
    }

    private  InetAddressUtils();

}