@Test public void testRightCompress() throws IPStringConversionException { assertTrue("Expected right Compression to work", right_uncompressed.equals(IPv6.expand(right_compressed, 8))); }
public static String expand(String ipStr, int nwords) throws IPStringConversionException { StringBuilder sb; String hex; int[] vals; int[] expanded_vals; int i; sb = new StringBuilder(); vals = splitvals(ipStr); if (vals == null) { throw new IPStringConversionException("Error converting hex to binary in IPv6 ip"); } expanded_vals = expand(vals, nwords); for (i = 0; i < nwords - 1; i++) { hex = String.format("%s:", IPUtils.int16bit2hex(expanded_vals[i])); sb.append(hex); } hex = String.format("%s", IPUtils.int16bit2hex(expanded_vals[nwords - 1])); sb.append(hex); return sb.toString(); }
IPv6 { public static String expand(String ipStr, int nwords) throws IPStringConversionException { StringBuilder sb; String hex; int[] vals; int[] expanded_vals; int i; sb = new StringBuilder(); vals = splitvals(ipStr); if (vals == null) { throw new IPStringConversionException("Error converting hex to binary in IPv6 ip"); } expanded_vals = expand(vals, nwords); for (i = 0; i < nwords - 1; i++) { hex = String.format("%s:", IPUtils.int16bit2hex(expanded_vals[i])); sb.append(hex); } hex = String.format("%s", IPUtils.int16bit2hex(expanded_vals[nwords - 1])); sb.append(hex); return sb.toString(); } }
IPv6 { public static String expand(String ipStr, int nwords) throws IPStringConversionException { StringBuilder sb; String hex; int[] vals; int[] expanded_vals; int i; sb = new StringBuilder(); vals = splitvals(ipStr); if (vals == null) { throw new IPStringConversionException("Error converting hex to binary in IPv6 ip"); } expanded_vals = expand(vals, nwords); for (i = 0; i < nwords - 1; i++) { hex = String.format("%s:", IPUtils.int16bit2hex(expanded_vals[i])); sb.append(hex); } hex = String.format("%s", IPUtils.int16bit2hex(expanded_vals[nwords - 1])); sb.append(hex); return sb.toString(); } IPv6();  IPv6(String ip);  IPv6(byte[] in); }
IPv6 { public static String expand(String ipStr, int nwords) throws IPStringConversionException { StringBuilder sb; String hex; int[] vals; int[] expanded_vals; int i; sb = new StringBuilder(); vals = splitvals(ipStr); if (vals == null) { throw new IPStringConversionException("Error converting hex to binary in IPv6 ip"); } expanded_vals = expand(vals, nwords); for (i = 0; i < nwords - 1; i++) { hex = String.format("%s:", IPUtils.int16bit2hex(expanded_vals[i])); sb.append(hex); } hex = String.format("%s", IPUtils.int16bit2hex(expanded_vals[nwords - 1])); sb.append(hex); return sb.toString(); } IPv6();  IPv6(String ip);  IPv6(byte[] in); static int[] splitvals(String ipStr); static int countnegatives(int[] in); static String expand(String ipStr, int nwords); String expand(); static int[] expand(int[] vals, int nwords); static byte[] IpString2bytes(String ipStr); static String bytes2IpString(byte[] in); void setIp(byte[] in); String getString(); byte[] getBytes(); void setIp(String ip); }
IPv6 { public static String expand(String ipStr, int nwords) throws IPStringConversionException { StringBuilder sb; String hex; int[] vals; int[] expanded_vals; int i; sb = new StringBuilder(); vals = splitvals(ipStr); if (vals == null) { throw new IPStringConversionException("Error converting hex to binary in IPv6 ip"); } expanded_vals = expand(vals, nwords); for (i = 0; i < nwords - 1; i++) { hex = String.format("%s:", IPUtils.int16bit2hex(expanded_vals[i])); sb.append(hex); } hex = String.format("%s", IPUtils.int16bit2hex(expanded_vals[nwords - 1])); sb.append(hex); return sb.toString(); } IPv6();  IPv6(String ip);  IPv6(byte[] in); static int[] splitvals(String ipStr); static int countnegatives(int[] in); static String expand(String ipStr, int nwords); String expand(); static int[] expand(int[] vals, int nwords); static byte[] IpString2bytes(String ipStr); static String bytes2IpString(byte[] in); void setIp(byte[] in); String getString(); byte[] getBytes(); void setIp(String ip);  }