@Test public void testCreate() { MultiSignaturePublicKey multisigPubKey = MultiSignaturePublicKey.create(asList(PublicKey.fromHexString(PUBKEY1), PublicKey.fromHexString(PUBKEY2), PublicKey.fromHexString(PUBKEY3)), 2); assertThat(multisigPubKey.toString(), is( "df2226d8633a4f392cca1c5d198ae10e99e1192b51b665d2d8ce06fa2896d3aec9a77a22407913ce2b0f4e360a228fdae8ca14db5055aa97296e828b7546bd36892bd1625b22d4bc1b1700d9f8aa822a7ad97ffa380fdf765aae7ce97a234e6b02")); }
public static MultiSignaturePublicKey create(List<PublicKey> publicKeys, int threshold) { byte[] multiSigPublicKeyBytes = new byte[publicKeys.size() * PUBLIC_KEY_LENGTH + 1]; int counter = 0; for (PublicKey pk : publicKeys) { byte[] pkBytes = pk.toArray(); System.arraycopy(pkBytes, 0, multiSigPublicKeyBytes, counter++ * PUBLIC_KEY_LENGTH, PUBLIC_KEY_LENGTH); } multiSigPublicKeyBytes[multiSigPublicKeyBytes.length - 1] = (byte) threshold; return new MultiSignaturePublicKey(ByteArray.from(multiSigPublicKeyBytes)); }
MultiSignaturePublicKey implements ByteSequence { public static MultiSignaturePublicKey create(List<PublicKey> publicKeys, int threshold) { byte[] multiSigPublicKeyBytes = new byte[publicKeys.size() * PUBLIC_KEY_LENGTH + 1]; int counter = 0; for (PublicKey pk : publicKeys) { byte[] pkBytes = pk.toArray(); System.arraycopy(pkBytes, 0, multiSigPublicKeyBytes, counter++ * PUBLIC_KEY_LENGTH, PUBLIC_KEY_LENGTH); } multiSigPublicKeyBytes[multiSigPublicKeyBytes.length - 1] = (byte) threshold; return new MultiSignaturePublicKey(ByteArray.from(multiSigPublicKeyBytes)); } }
MultiSignaturePublicKey implements ByteSequence { public static MultiSignaturePublicKey create(List<PublicKey> publicKeys, int threshold) { byte[] multiSigPublicKeyBytes = new byte[publicKeys.size() * PUBLIC_KEY_LENGTH + 1]; int counter = 0; for (PublicKey pk : publicKeys) { byte[] pkBytes = pk.toArray(); System.arraycopy(pkBytes, 0, multiSigPublicKeyBytes, counter++ * PUBLIC_KEY_LENGTH, PUBLIC_KEY_LENGTH); } multiSigPublicKeyBytes[multiSigPublicKeyBytes.length - 1] = (byte) threshold; return new MultiSignaturePublicKey(ByteArray.from(multiSigPublicKeyBytes)); } private  MultiSignaturePublicKey(ByteArray bytes); }
MultiSignaturePublicKey implements ByteSequence { public static MultiSignaturePublicKey create(List<PublicKey> publicKeys, int threshold) { byte[] multiSigPublicKeyBytes = new byte[publicKeys.size() * PUBLIC_KEY_LENGTH + 1]; int counter = 0; for (PublicKey pk : publicKeys) { byte[] pkBytes = pk.toArray(); System.arraycopy(pkBytes, 0, multiSigPublicKeyBytes, counter++ * PUBLIC_KEY_LENGTH, PUBLIC_KEY_LENGTH); } multiSigPublicKeyBytes[multiSigPublicKeyBytes.length - 1] = (byte) threshold; return new MultiSignaturePublicKey(ByteArray.from(multiSigPublicKeyBytes)); } private  MultiSignaturePublicKey(ByteArray bytes); static MultiSignaturePublicKey create(List<PublicKey> publicKeys, int threshold); byte[] toArray(); @Override String toString(); }
MultiSignaturePublicKey implements ByteSequence { public static MultiSignaturePublicKey create(List<PublicKey> publicKeys, int threshold) { byte[] multiSigPublicKeyBytes = new byte[publicKeys.size() * PUBLIC_KEY_LENGTH + 1]; int counter = 0; for (PublicKey pk : publicKeys) { byte[] pkBytes = pk.toArray(); System.arraycopy(pkBytes, 0, multiSigPublicKeyBytes, counter++ * PUBLIC_KEY_LENGTH, PUBLIC_KEY_LENGTH); } multiSigPublicKeyBytes[multiSigPublicKeyBytes.length - 1] = (byte) threshold; return new MultiSignaturePublicKey(ByteArray.from(multiSigPublicKeyBytes)); } private  MultiSignaturePublicKey(ByteArray bytes); static MultiSignaturePublicKey create(List<PublicKey> publicKeys, int threshold); byte[] toArray(); @Override String toString();  }