@Test public void shouldGet768IpsWhenConverting3ValidClassCNets() throws IPBlocksOverLapException, IPStringConversionException, IPOctetOutOfRangeException, IPCidrBlockOutOfRangeException { List<String> blocks = new ArrayList<String>(); List<String> ipAddresses = new ArrayList<String>(); blocks.add("127.0.0.0/24"); blocks.add("127.0.1.0/24"); blocks.add("127.0.2.0/24"); ipAddresses = IPv4ToolSet.ipv4BlocksToIpStrings(blocks); assertEquals(768, ipAddresses.size()); }
public static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks) throws IPBlocksOverLapException, IPStringConversionException, IPOctetOutOfRangeException, IPCidrBlockOutOfRangeException { List<String> ipStrings = new ArrayList(); IPv4Ranges ranges = new IPv4Ranges(); for (String ipBlock : ipBlocks) { ranges.add(ipBlock); ipStrings.addAll(ipv4BlockToIpStrings(ipBlock)); } return ipStrings; }
IPv4ToolSet { public static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks) throws IPBlocksOverLapException, IPStringConversionException, IPOctetOutOfRangeException, IPCidrBlockOutOfRangeException { List<String> ipStrings = new ArrayList(); IPv4Ranges ranges = new IPv4Ranges(); for (String ipBlock : ipBlocks) { ranges.add(ipBlock); ipStrings.addAll(ipv4BlockToIpStrings(ipBlock)); } return ipStrings; } }
IPv4ToolSet { public static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks) throws IPBlocksOverLapException, IPStringConversionException, IPOctetOutOfRangeException, IPCidrBlockOutOfRangeException { List<String> ipStrings = new ArrayList(); IPv4Ranges ranges = new IPv4Ranges(); for (String ipBlock : ipBlocks) { ranges.add(ipBlock); ipStrings.addAll(ipv4BlockToIpStrings(ipBlock)); } return ipStrings; }  }
IPv4ToolSet { public static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks) throws IPBlocksOverLapException, IPStringConversionException, IPOctetOutOfRangeException, IPCidrBlockOutOfRangeException { List<String> ipStrings = new ArrayList(); IPv4Ranges ranges = new IPv4Ranges(); for (String ipBlock : ipBlocks) { ranges.add(ipBlock); ipStrings.addAll(ipv4BlockToIpStrings(ipBlock)); } return ipStrings; }  static String long2ip(long ipLong); static long mask_bits(int bits); static List<String> ipv4BlockToIpStrings(String blockString); static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks); static IPv4Range ipv4BlockToRange(String blockString); static boolean isValid(String ip); static long ip2long(String ip); static boolean rejectUnwantedIps(String ip); }
IPv4ToolSet { public static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks) throws IPBlocksOverLapException, IPStringConversionException, IPOctetOutOfRangeException, IPCidrBlockOutOfRangeException { List<String> ipStrings = new ArrayList(); IPv4Ranges ranges = new IPv4Ranges(); for (String ipBlock : ipBlocks) { ranges.add(ipBlock); ipStrings.addAll(ipv4BlockToIpStrings(ipBlock)); } return ipStrings; }  static String long2ip(long ipLong); static long mask_bits(int bits); static List<String> ipv4BlockToIpStrings(String blockString); static List<String> ipv4BlocksToIpStrings(List<String> ipBlocks); static IPv4Range ipv4BlockToRange(String blockString); static boolean isValid(String ip); static long ip2long(String ip); static boolean rejectUnwantedIps(String ip);  }