@Test(dataProvider = "IpAddresses") public void testLongToIp(String expectedIpAddress, long value) { InetAddress out = IpHelper.longToIp(value); assertThat(out.getHostAddress(), is(equalTo(expectedIpAddress))); }
public static InetAddress longToIp(long ip) { try { return InetAddress.getByAddress(longToNetworkByteOrderArray(ip)); } catch (UnknownHostException e) { throw new IllegalArgumentException("Invalid IP " + ip); } }
IpHelper { public static InetAddress longToIp(long ip) { try { return InetAddress.getByAddress(longToNetworkByteOrderArray(ip)); } catch (UnknownHostException e) { throw new IllegalArgumentException("Invalid IP " + ip); } } }
IpHelper { public static InetAddress longToIp(long ip) { try { return InetAddress.getByAddress(longToNetworkByteOrderArray(ip)); } catch (UnknownHostException e) { throw new IllegalArgumentException("Invalid IP " + ip); } }  }
IpHelper { public static InetAddress longToIp(long ip) { try { return InetAddress.getByAddress(longToNetworkByteOrderArray(ip)); } catch (UnknownHostException e) { throw new IllegalArgumentException("Invalid IP " + ip); } }  static long ipToLong(Inet4Address ip); static InetAddress longToIp(long ip); static String longToIpString(long ip); static long ipStringToLong(String ip); static byte[] longToNetworkByteOrderArray(long addr); static String calculateCidrFromIpV4Range(long ipLow, long ipHigh); static InetAddress calculateNetmaskFromCidr(String cidr); static String calculateNetmaskStringFromCidr(String cidr); static int safeLongToInt(long l); }
IpHelper { public static InetAddress longToIp(long ip) { try { return InetAddress.getByAddress(longToNetworkByteOrderArray(ip)); } catch (UnknownHostException e) { throw new IllegalArgumentException("Invalid IP " + ip); } }  static long ipToLong(Inet4Address ip); static InetAddress longToIp(long ip); static String longToIpString(long ip); static long ipStringToLong(String ip); static byte[] longToNetworkByteOrderArray(long addr); static String calculateCidrFromIpV4Range(long ipLow, long ipHigh); static InetAddress calculateNetmaskFromCidr(String cidr); static String calculateNetmaskStringFromCidr(String cidr); static int safeLongToInt(long l);  }