### Question:
BridgeSerializationUtils { public static byte[] serializeMapOfHashesToLong(Map<Sha256Hash, Long> map) { byte[][] bytes = new byte[map.size() * 2][]; int n = 0; List<Sha256Hash> sortedHashes = new ArrayList<>(map.keySet()); Collections.sort(sortedHashes); for (Sha256Hash hash : sortedHashes) { Long value = map.get(hash); bytes[n++] = RLP.encodeElement(hash.getBytes()); bytes[n++] = RLP.encodeBigInteger(BigInteger.valueOf(value)); } return RLP.encodeList(bytes); } private  BridgeSerializationUtils(); static byte[] serializeMap(SortedMap<Keccak256, UldTransaction> map); static SortedMap<Keccak256, UldTransaction> deserializeMap(byte[] data, NetworkParameters networkParameters, boolean noInputsTxs); static byte[] serializeUTXOList(List<UTXO> list); static List<UTXO> deserializeUTXOList(byte[] data); static byte[] serializeSet(SortedSet<Sha256Hash> set); static SortedSet<Sha256Hash> deserializeSet(byte[] data); static byte[] serializeMapOfHashesToLong(Map<Sha256Hash, Long> map); static Map<Sha256Hash, Long> deserializeMapOfHashesToLong(byte[] data); static byte[] serializeFederation(Federation federation); static Federation deserializeFederation(byte[] data, Context uldContext); static byte[] serializePendingFederation(PendingFederation pendingFederation); static PendingFederation deserializePendingFederation(byte[] data); static byte[] serializeElection(ABICallElection election); static ABICallElection deserializeElection(byte[] data, AddressBasedAuthorizer authorizer); static byte[] serializeOneOffLockWhitelist(Pair<List<OneOffWhiteListEntry>, Integer> data); static byte[] serializeUnlimitedLockWhitelist(List<UnlimitedWhiteListEntry> entries); static Pair<HashMap<Address, OneOffWhiteListEntry>, Integer> deserializeOneOffLockWhitelistAndDisableBlockHeight(byte[] data, NetworkParameters parameters); static Map<Address, UnlimitedWhiteListEntry> deserializeUnlimitedLockWhitelistEntries(byte[] data, NetworkParameters parameters); static byte[] serializeCoin(Coin coin); @Nullable static Coin deserializeCoin(byte[] data); static byte[] serializeReleaseRequestQueue(ReleaseRequestQueue queue); static ReleaseRequestQueue deserializeReleaseRequestQueue(byte[] data, NetworkParameters networkParameters); static byte[] serializeReleaseTransactionSet(ReleaseTransactionSet set); static ReleaseTransactionSet deserializeReleaseTransactionSet(byte[] data, NetworkParameters networkParameters);  }### Answer:
@Test public void serializeMapOfHashesToLong() throws Exception { PowerMockito.mockStatic(RLP.class); mock_RLP_encodeElement(); mock_RLP_encodeBigInteger(); mock_RLP_encodeList(); Map<Sha256Hash, Long> sample = new HashMap<>(); sample.put(Sha256Hash.wrap(charNTimes('b', 64)), 1L); sample.put(Sha256Hash.wrap(charNTimes('d', 64)), 2L); sample.put(Sha256Hash.wrap(charNTimes('a', 64)), 3L); sample.put(Sha256Hash.wrap(charNTimes('c', 64)), 4L); byte[] result = BridgeSerializationUtils.serializeMapOfHashesToLong(sample); String hexResult = Hex.toHexString(result); StringBuilder expectedBuilder = new StringBuilder(); char[] sorted = new char[]{'a','b','c','d'}; for (char c : sorted) { String key = charNTimes(c, 64); expectedBuilder.append("dd"); expectedBuilder.append(key); expectedBuilder.append("ff"); expectedBuilder.append(Hex.toHexString(BigInteger.valueOf(sample.get(Sha256Hash.wrap(key))).toByteArray())); } assertEquals(expectedBuilder.toString(), hexResult); }