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 testArrayOfStrings() {
        DynamicArray<Utf8String> array =
                new DynamicArray<>(
                        new Utf8String(
                                "This string value is extra long so that it "
                                        + "requires more than 32 bytes"),
                        new Utf8String("abc"),
                        new Utf8String(""),
                        new Utf8String("web3j"));
        DynamicArray emptyArray = DynamicArray.empty("string");
        DynamicArray<Utf8String> arrayOfEmptyStrings =
                new DynamicArray<>(new Utf8String(""), new Utf8String(""));

        assertEquals(
                TypeEncoder.encodeDynamicArray(array),
                //  array length
                ("0000000000000000000000000000000000000000000000000000000000000004"
                        // offset first string
                        + "0000000000000000000000000000000000000000000000000000000000000080"
                        // offset second string
                        + "0000000000000000000000000000000000000000000000000000000000000100"
                        // offset third string
                        + "0000000000000000000000000000000000000000000000000000000000000140"
                        // offset fourth string
                        + "0000000000000000000000000000000000000000000000000000000000000160"
                        // length first string
                        + "0000000000000000000000000000000000000000000000000000000000000046"
                        // first string
                        + "5468697320737472696e672076616c7565206973206578747261206c6f6e6720"
                        // first string continued
                        + "736f2074686174206974207265717569726573206d6f7265207468616e203332"
                        // first string continued
                        + "2062797465730000000000000000000000000000000000000000000000000000"
                        // length second string
                        + "0000000000000000000000000000000000000000000000000000000000000003"
                        // second string
                        + "6162630000000000000000000000000000000000000000000000000000000000"
                        // length third string
                        + "0000000000000000000000000000000000000000000000000000000000000000"
                        // length fourth string
                        + "0000000000000000000000000000000000000000000000000000000000000005"
                        // fourth string
                        + "776562336a000000000000000000000000000000000000000000000000000000"));
        assertEquals(
                TypeEncoder.encodeDynamicArray(emptyArray),
                //  array length
                ("0000000000000000000000000000000000000000000000000000000000000000"));
        assertEquals(
                TypeEncoder.encodeDynamicArray(arrayOfEmptyStrings),
                //  array length
                ("0000000000000000000000000000000000000000000000000000000000000002"
                        // offset first string
                        + "0000000000000000000000000000000000000000000000000000000000000040"
                        // offset second string
                        + "0000000000000000000000000000000000000000000000000000000000000060"
                        // length first string
                        + "0000000000000000000000000000000000000000000000000000000000000000"
                        // length second string
                        + "0000000000000000000000000000000000000000000000000000000000000000"));
    }