PcapUtils { public static String convertHexToIpv4Ip(String hex) { List<Integer> ipSegments = new ArrayList<>(); for(int i = 0; i < hex.length(); i += 2) { String segment = hex.substring(i, i + 2); ipSegments.add(Integer.parseInt(segment, 16)); } return Joiner.on(".").join(ipSegments); }  static String convertIpv4IpToHex(String ipAddress); static String convertHexToIpv4Ip(String hex); static String getSessionKey(String srcIp, String dstIp,
      String protocol, String srcPort, String dstPort); static String getSessionKey(String srcIp, String dstIp,
      String protocol, String srcPort, String dstPort, String ipId,
      String fragmentOffset); static String getSessionKey(JSONObject message); static String getPartialSessionKey(String srcIp, String dstIp,
                                            String protocol, String srcPort, String dstPort); static String getSessionKey(String srcIp, String dstIp, int protocol,
      int srcPort, int dstPort, int ipId, int fragmentOffset); static String getShortSessionKey(String srcIp, String dstIp, int protocol,
      int srcPort, int dstPort); static String convertIpSegmentToHex(String ipSegment); static String convertIpSegmentToHex(int ipSegment); static String convertToHex(int number, int length); static String getProtocolNameFromId(int protocolNumber); static int getProtocolIdFromName(String protocolName);  }
@Test public void testConvertHexToIpv4Ip() { String hex = "c0a88a9e"; String ipAddress = PcapUtils.convertHexToIpv4Ip(hex); assertEquals("192.168.138.158", ipAddress); }