@Test public void testToIPv4() { long address = (((((1L << 8) | 1) << 8) | 1) << 8) | 1; assertThat(NetworkExt.toIPv4(address)).isEqualTo("1.1.1.1"); }
public static String toIPv4(long addressLong) { return Long.toString(addressLong >> 24 & 0xFF) + '.' + Long.toString(addressLong >> 16 & 0xFF) + '.' + Long.toString(addressLong >> 8 & 0xFF) + '.' + Long.toString(addressLong & 0xFF); }
NetworkExt { public static String toIPv4(long addressLong) { return Long.toString(addressLong >> 24 & 0xFF) + '.' + Long.toString(addressLong >> 16 & 0xFF) + '.' + Long.toString(addressLong >> 8 & 0xFF) + '.' + Long.toString(addressLong & 0xFF); } }
NetworkExt { public static String toIPv4(long addressLong) { return Long.toString(addressLong >> 24 & 0xFF) + '.' + Long.toString(addressLong >> 16 & 0xFF) + '.' + Long.toString(addressLong >> 8 & 0xFF) + '.' + Long.toString(addressLong & 0xFF); }  }
NetworkExt { public static String toIPv4(long addressLong) { return Long.toString(addressLong >> 24 & 0xFF) + '.' + Long.toString(addressLong >> 16 & 0xFF) + '.' + Long.toString(addressLong >> 8 & 0xFF) + '.' + Long.toString(addressLong & 0xFF); }  static int findUnusedPort(); static Optional<String> getHostName(); static String resolveHostName(); static boolean isLoopbackIP(String ip); static boolean isIPv6(String ip); static Optional<List<String>> getLocalIPs(boolean ipv4Only); static Optional<List<String>> getLocalIPs(); static List<String> resolveLocalIPs(boolean ipv4Only); static String toIPv4(long addressLong); static String toIpV6AddressName(Inet6Address inet6Address); static long toNetworkBitMask(int maskLength); static boolean matches(String ipAddress, NetworkAddress networkAddress); static boolean matches(long ipAddress, NetworkAddress networkAddress); static Function<String, Boolean> buildNetworkMatchPredicate(List<String> cdirs); static NetworkAddress parseCDIR(String cdir); static boolean isIpV4(String address); static long toBits(String ipv4Address); }
NetworkExt { public static String toIPv4(long addressLong) { return Long.toString(addressLong >> 24 & 0xFF) + '.' + Long.toString(addressLong >> 16 & 0xFF) + '.' + Long.toString(addressLong >> 8 & 0xFF) + '.' + Long.toString(addressLong & 0xFF); }  static int findUnusedPort(); static Optional<String> getHostName(); static String resolveHostName(); static boolean isLoopbackIP(String ip); static boolean isIPv6(String ip); static Optional<List<String>> getLocalIPs(boolean ipv4Only); static Optional<List<String>> getLocalIPs(); static List<String> resolveLocalIPs(boolean ipv4Only); static String toIPv4(long addressLong); static String toIpV6AddressName(Inet6Address inet6Address); static long toNetworkBitMask(int maskLength); static boolean matches(String ipAddress, NetworkAddress networkAddress); static boolean matches(long ipAddress, NetworkAddress networkAddress); static Function<String, Boolean> buildNetworkMatchPredicate(List<String> cdirs); static NetworkAddress parseCDIR(String cdir); static boolean isIpV4(String address); static long toBits(String ipv4Address); static final String IP4_LOOPBACK; static final String IP6_LOOPBACK; }