/**
  * Get an IPv6 address with long format. Return IPv6 address without ::, e.g. ::1 =>
  * 0:0:0:0:0:0:0:1
  *
  * @param inet6Address the IPv6 address to format
  * @return long format IPv6 address
  * @throws UnknownHostException if host with IPv6 address is not alive
  */
 public static String getLongInet6Address(String inet6Address) throws UnknownHostException {
   String longAddress = Inet6Address.getByName(inet6Address).getHostAddress();
   return longAddress;
 }
 /**
  * Compress an IPv6 address. Return compressed address, e.g. 0:0:0:0:0:0:0:01 => ::1
  *
  * @param inet6Address the IPv6 address to compress
  * @return compressed IPv6 address
  * @throws UnknownHostException if host with IPv6 address is not alive
  */
 public static String getCompressedInet6Address(String inet6Address) throws UnknownHostException {
   String longAddress = Inet6Address.getByName(inet6Address).getHostAddress();
   return longAddress.replaceFirst("(^|:)(0+(:|$)){2,8}", "::");
 }