TransactionEncodeUtil extends TransactionUtil { public static RawTransactionContainer encodeTransaction(final Transaction transaction) { return encodeTransaction(transaction, new RawTransactionContainer()); } private  TransactionEncodeUtil(); static RawTransactionContainer encodeTransaction(final Transaction transaction); static RawTransactionContainer encodeTransaction(final Transaction transaction, final RawTransactionContainer container);  }
@Test public void testConsistency() { final Transaction tx = TransactionParseUtil.parseTransactionBytes(Hex.decode(TEST_TX)); final RawTransactionContainer reencoded = TransactionEncodeUtil.encodeTransaction(tx); final ArrayList<Byte> bytes = new ArrayList<Byte>(); for (final Entry<TransactionPartType, byte[]> part : reencoded) { for (final byte bite : part.getValue()) { bytes.add(bite); } } final byte[] primitiveBytes = new byte[bytes.size()]; int i = 0; for(final byte bite : bytes) { primitiveBytes[i++] = bite; } final byte[] encode = Hex.encode(primitiveBytes); Assert.assertEquals(TEST_TX, new String(encode)); }