### Question:
SecureKeyBlockBuilder { public String toKeyBlock(SecureKeyBlock skb) { StringBuilder sb = new StringBuilder(); sb.append(skb.getKeyBlockVersion()); sb.append(String.format("%04d", skb.getKeyBlockLength())); sb.append(skb.getKeyUsage().getCode()); sb.append(skb.getAlgorithm().getCode()); sb.append(skb.getModeOfUse().getCode()); sb.append(skb.getKeyVersion()); sb.append(skb.getExportability().getCode()); Map<String, String> optHdr = skb.getOptionalHeaders(); sb.append(String.format("%02d", optHdr.size())); sb.append(skb.getReserved()); for (Entry<String, String> ent : optHdr.entrySet()) { sb.append(ent.getKey()); sb.append(String.format("%02X", ent.getValue().length() + SIZE_OPTHDR_ID + SIZE_OPTHDR_LENGTH)); sb.append(ent.getValue()); } byte[] b = skb.getKeyBytes(); if (b != null) sb.append(ISOUtil.hexString(b)); b = skb.getKeyBlockMAC(); if (b != null) sb.append(ISOUtil.hexString(skb.getKeyBlockMAC())); return sb.toString(); } private  SecureKeyBlockBuilder(); static SecureKeyBlockBuilder newBuilder(); SecureKeyBlockBuilder with4characterMACVersions(String versions); SecureKeyBlock build(CharSequence data); String toKeyBlock(SecureKeyBlock skb);  }### Answer:
@Test public void testToKeyBlock() { String data = "E0046V2TGc3E0233" + OPTHEADER_KS + OPTHEADER_KV + ISOUtil.hexString(KEYBLOCK_MAC8); ret = instance.build(data); assertEquals(data, instance.toKeyBlock(ret)); }