static <T extends Type> String encodeDynamicArray(DynamicArray<T> value) {
        int size = value.getValue().size();
        String encodedLength = encode(new Uint(BigInteger.valueOf(size)));
        String valuesOffsets = encodeArrayValuesOffsets(value);
        String encodedValues = encodeArrayValues(value);

        StringBuilder result = new StringBuilder();
        result.append(encodedLength);
        result.append(valuesOffsets);
        result.append(encodedValues);
        return result.toString();
    }
@SuppressWarnings("unchecked")
    @Test
    public void testArrayOfBytes() {
        DynamicArray<DynamicBytes> array =
                new DynamicArray<>(
                        new DynamicBytes(
                                Numeric.hexStringToByteArray(
                                        "0x3c329ee8cd725a7f74f984cac52598eb170d731e7f3"
                                                + "80d59a18aa861d2c8d6c43c880b2bfe0f3cde4efcd7"
                                                + "11c010c2f1d8af5e796f06716539446f95420df4211c")),
                        new DynamicBytes(
                                Numeric.hexStringToByteArray("0xcafe0000cafe0000cafe0000")),
                        new DynamicBytes(
                                Numeric.hexStringToByteArray(
                                        "0x9215c928b97e0ebeeefd10003a4e3eea23f2eb3acba"
                                                + "b477eeb589d7a8874d7c5")));
        DynamicArray emptyArray = DynamicArray.empty("bytes");
        DynamicArray<DynamicBytes> arrayOfEmptyBytes =
                new DynamicArray<>(new DynamicBytes(new byte[0]), new DynamicBytes(new byte[0]));

        assertEquals(
                TypeEncoder.encodeDynamicArray(array),
                //  array length
                ("0000000000000000000000000000000000000000000000000000000000000003"
                        // offset first bytes
                        + "0000000000000000000000000000000000000000000000000000000000000060"
                        // offset second bytes
                        + "00000000000000000000000000000000000000000000000000000000000000e0"
                        // offset third bytes
                        + "0000000000000000000000000000000000000000000000000000000000000120"
                        // length first bytes
                        + "0000000000000000000000000000000000000000000000000000000000000041"
                        // first bytes
                        + "3c329ee8cd725a7f74f984cac52598eb170d731e7f380d59a18aa861d2c8d6c4"
                        // first bytes continued
                        + "3c880b2bfe0f3cde4efcd711c010c2f1d8af5e796f06716539446f95420df421"
                        // first bytes continued
                        + "1c00000000000000000000000000000000000000000000000000000000000000"
                        // length second bytes
                        + "000000000000000000000000000000000000000000000000000000000000000c"
                        // second bytes
                        + "cafe0000cafe0000cafe00000000000000000000000000000000000000000000"
                        // length third bytes
                        + "0000000000000000000000000000000000000000000000000000000000000020"
                        // third bytes
                        + "9215c928b97e0ebeeefd10003a4e3eea23f2eb3acbab477eeb589d7a8874d7c5"));
        assertEquals(
                TypeEncoder.encodeDynamicArray(emptyArray),
                //  array length
                ("0000000000000000000000000000000000000000000000000000000000000000"));
        assertEquals(
                TypeEncoder.encodeDynamicArray(arrayOfEmptyBytes),
                //  array length
                ("0000000000000000000000000000000000000000000000000000000000000002"
                        // offset first bytes
                        + "0000000000000000000000000000000000000000000000000000000000000040"
                        // offset second bytes
                        + "0000000000000000000000000000000000000000000000000000000000000060"
                        // length first bytes
                        + "0000000000000000000000000000000000000000000000000000000000000000"
                        // length second bytes
                        + "0000000000000000000000000000000000000000000000000000000000000000"));
    }