@Test public void testSetAccountPartition() throws NoSuchAlgorithmException, IPStringConversionException{ IPv6 control = new IPv6("ffff::"); IPv6 expected = new IPv6("ffff::f0c6:5ccc:0000:0000"); control.setAccountPartition(354934); assertEquals(expected, control); }
public void setAccountPartition(int accountId) throws IPStringConversionException { byte[] accountBytes = String.format("%s", accountId).getBytes(); byte[] accountSha1; try { accountSha1 = HashUtil.sha1sum(accountBytes, 0, 4); } catch (NoSuchAlgorithmException ex) { throw new AccountUnHashableException("Account was not sha1 Sum Hashable", ex); } BigInteger sha1Int = new BigInteger(1, accountSha1); this.insertBigInteger(sha1Int, 64, 32); }
IPv6 implements Comparable<IPv6> { public void setAccountPartition(int accountId) throws IPStringConversionException { byte[] accountBytes = String.format("%s", accountId).getBytes(); byte[] accountSha1; try { accountSha1 = HashUtil.sha1sum(accountBytes, 0, 4); } catch (NoSuchAlgorithmException ex) { throw new AccountUnHashableException("Account was not sha1 Sum Hashable", ex); } BigInteger sha1Int = new BigInteger(1, accountSha1); this.insertBigInteger(sha1Int, 64, 32); } }
IPv6 implements Comparable<IPv6> { public void setAccountPartition(int accountId) throws IPStringConversionException { byte[] accountBytes = String.format("%s", accountId).getBytes(); byte[] accountSha1; try { accountSha1 = HashUtil.sha1sum(accountBytes, 0, 4); } catch (NoSuchAlgorithmException ex) { throw new AccountUnHashableException("Account was not sha1 Sum Hashable", ex); } BigInteger sha1Int = new BigInteger(1, accountSha1); this.insertBigInteger(sha1Int, 64, 32); } IPv6(BigInteger in);  IPv6();  IPv6(String ip);  IPv6(byte[] in); }
IPv6 implements Comparable<IPv6> { public void setAccountPartition(int accountId) throws IPStringConversionException { byte[] accountBytes = String.format("%s", accountId).getBytes(); byte[] accountSha1; try { accountSha1 = HashUtil.sha1sum(accountBytes, 0, 4); } catch (NoSuchAlgorithmException ex) { throw new AccountUnHashableException("Account was not sha1 Sum Hashable", ex); } BigInteger sha1Int = new BigInteger(1, accountSha1); this.insertBigInteger(sha1Int, 64, 32); } IPv6(BigInteger in);  IPv6();  IPv6(String ip);  IPv6(byte[] in); static String expand(String ipStr, int nwords); String expand(); BigInteger toBigInteger(); static IPv6 bigInteger2IPv6(BigInteger in); static byte[] IpString2bytes(String ipStr); static String bytes2IpString(byte[] in); void setIp(byte[] in); String getString(); byte[] getBytes(); void setIp(String ip); void insertInteger(int in, int startBit); void insertBigInteger(BigInteger in, int startBit, int size); void setAccountPartition(int accountId); void setVipOctets(int lo); int getVipOctets(); void setClusterPartition(IPv6Cidr clusterCidr); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(IPv6 that); }
IPv6 implements Comparable<IPv6> { public void setAccountPartition(int accountId) throws IPStringConversionException { byte[] accountBytes = String.format("%s", accountId).getBytes(); byte[] accountSha1; try { accountSha1 = HashUtil.sha1sum(accountBytes, 0, 4); } catch (NoSuchAlgorithmException ex) { throw new AccountUnHashableException("Account was not sha1 Sum Hashable", ex); } BigInteger sha1Int = new BigInteger(1, accountSha1); this.insertBigInteger(sha1Int, 64, 32); } IPv6(BigInteger in);  IPv6();  IPv6(String ip);  IPv6(byte[] in); static String expand(String ipStr, int nwords); String expand(); BigInteger toBigInteger(); static IPv6 bigInteger2IPv6(BigInteger in); static byte[] IpString2bytes(String ipStr); static String bytes2IpString(byte[] in); void setIp(byte[] in); String getString(); byte[] getBytes(); void setIp(String ip); void insertInteger(int in, int startBit); void insertBigInteger(BigInteger in, int startBit, int size); void setAccountPartition(int accountId); void setVipOctets(int lo); int getVipOctets(); void setClusterPartition(IPv6Cidr clusterCidr); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(IPv6 that);  }