@Test public void shouldConvertLong2IpString() { assertTrue("172.16.0.0".equals(IPv4ToolSet.long2ip(2886729728L))); }
public static String long2ip(long ipLong) { long o4 = (ipLong >> 24) & 0xFF; long o3 = (ipLong >> 16) & 0xFF; long o2 = (ipLong >> 8) & 0xFF; long o1 = (ipLong >> 0) & 0xFF; return String.format("%d.%d.%d.%d", o4, o3, o2, o1); }
IPv4ToolSet { public static String long2ip(long ipLong) { long o4 = (ipLong >> 24) & 0xFF; long o3 = (ipLong >> 16) & 0xFF; long o2 = (ipLong >> 8) & 0xFF; long o1 = (ipLong >> 0) & 0xFF; return String.format("%d.%d.%d.%d", o4, o3, o2, o1); } }
IPv4ToolSet { public static String long2ip(long ipLong) { long o4 = (ipLong >> 24) & 0xFF; long o3 = (ipLong >> 16) & 0xFF; long o2 = (ipLong >> 8) & 0xFF; long o1 = (ipLong >> 0) & 0xFF; return String.format("%d.%d.%d.%d", o4, o3, o2, o1); }  }
IPv4ToolSet { public static String long2ip(long ipLong) { long o4 = (ipLong >> 24) & 0xFF; long o3 = (ipLong >> 16) & 0xFF; long o2 = (ipLong >> 8) & 0xFF; long o1 = (ipLong >> 0) & 0xFF; return String.format("%d.%d.%d.%d", o4, o3, o2, o1); }  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 String long2ip(long ipLong) { long o4 = (ipLong >> 24) & 0xFF; long o3 = (ipLong >> 16) & 0xFF; long o2 = (ipLong >> 8) & 0xFF; long o1 = (ipLong >> 0) & 0xFF; return String.format("%d.%d.%d.%d", o4, o3, o2, o1); }  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);  }