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();
    }
@Test
    public void testDynamicArrayOfDynamicArraysOfStaticStructs() {
        DynamicArray<DynamicArray<Bar>> array =
                new DynamicArray(
                        DynamicArray.class,
                        Arrays.asList(
                                new DynamicArray(
                                        Bar.class,
                                        new Bar(
                                                new Uint256(BigInteger.ZERO),
                                                new Uint256(BigInteger.ZERO))),
                                new DynamicArray(
                                        Bar.class,
                                        new Bar(
                                                new Uint256(BigInteger.ONE),
                                                new Uint256(BigInteger.ZERO)))));
        assertEquals(
                ("0000000000000000000000000000000000000000000000000000000000000002"
                        + "0000000000000000000000000000000000000000000000000000000000000040"
                        + "00000000000000000000000000000000000000000000000000000000000000a0"
                        + "0000000000000000000000000000000000000000000000000000000000000001"
                        + "0000000000000000000000000000000000000000000000000000000000000000"
                        + "0000000000000000000000000000000000000000000000000000000000000000"
                        + "0000000000000000000000000000000000000000000000000000000000000001"
                        + "0000000000000000000000000000000000000000000000000000000000000001"
                        + "0000000000000000000000000000000000000000000000000000000000000000"),
                TypeEncoder.encodeDynamicArray(array));
    }