@Test(dataProvider = "invalidLongInputsDataProvider", expectedExceptions = IllegalArgumentException.class) public void invalidLongInputs(long ipAsLong) { AddressUtils.longToIpv4(ipAsLong); }
public static String longToIpv4(long ipAsLong) { Validate.inclusiveBetween(LOWEST_IP, HIGHEST_IP, ipAsLong); int octetA = (int) ((ipAsLong >> 24) % 256); int octetB = (int) ((ipAsLong >> 16) % 256); int octetC = (int) ((ipAsLong >> 8) % 256); int octetD = (int) ((ipAsLong) % 256); return octetA + "." + octetB + "." + octetC + "." + octetD; }
AddressUtils { public static String longToIpv4(long ipAsLong) { Validate.inclusiveBetween(LOWEST_IP, HIGHEST_IP, ipAsLong); int octetA = (int) ((ipAsLong >> 24) % 256); int octetB = (int) ((ipAsLong >> 16) % 256); int octetC = (int) ((ipAsLong >> 8) % 256); int octetD = (int) ((ipAsLong) % 256); return octetA + "." + octetB + "." + octetC + "." + octetD; } }
AddressUtils { public static String longToIpv4(long ipAsLong) { Validate.inclusiveBetween(LOWEST_IP, HIGHEST_IP, ipAsLong); int octetA = (int) ((ipAsLong >> 24) % 256); int octetB = (int) ((ipAsLong >> 16) % 256); int octetC = (int) ((ipAsLong >> 8) % 256); int octetD = (int) ((ipAsLong) % 256); return octetA + "." + octetB + "." + octetC + "." + octetD; } private  AddressUtils(); }
AddressUtils { public static String longToIpv4(long ipAsLong) { Validate.inclusiveBetween(LOWEST_IP, HIGHEST_IP, ipAsLong); int octetA = (int) ((ipAsLong >> 24) % 256); int octetB = (int) ((ipAsLong >> 16) % 256); int octetC = (int) ((ipAsLong >> 8) % 256); int octetD = (int) ((ipAsLong) % 256); return octetA + "." + octetB + "." + octetC + "." + octetD; } private  AddressUtils(); static String longToIpv4(long ipAsLong); static long ipv4ToLong(String ipAsText); static String toCIDR(long ipA, long ipB); static long numberOfAddress(String cidrAddress); }
AddressUtils { public static String longToIpv4(long ipAsLong) { Validate.inclusiveBetween(LOWEST_IP, HIGHEST_IP, ipAsLong); int octetA = (int) ((ipAsLong >> 24) % 256); int octetB = (int) ((ipAsLong >> 16) % 256); int octetC = (int) ((ipAsLong >> 8) % 256); int octetD = (int) ((ipAsLong) % 256); return octetA + "." + octetB + "." + octetC + "." + octetD; } private  AddressUtils(); static String longToIpv4(long ipAsLong); static long ipv4ToLong(String ipAsText); static String toCIDR(long ipA, long ipB); static long numberOfAddress(String cidrAddress);  }