### Question:
TypeDecoder { @SuppressWarnings("unchecked") static <T extends Type> T decodeStaticArray( String input, int offset, TypeReference<T> typeReference, int length, long chainId) { BiFunction<List<T>, String, T> function = (elements, typeName) -> { if (elements.isEmpty()) { throw new UnsupportedOperationException("Zero length fixed array is invalid type"); } else { return instantiateStaticArray(typeReference, elements, length); } }; return decodeArrayElements(input, offset, typeReference, length, function, chainId); }  static T decode(
            String input, int offset, TypeReference<T> typeReference,long chainId);  }### Answer:
@Test public void testStaticArray() { assertThat(TypeDecoder.decodeStaticArray( "000000000000000000000000000000000000000000000000000000000000000a" + "0000000000000000000000000000000000000000000000007fffffffffffffff", 0, new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(2) {}, 2, NetworkParameters.MainNetParams.getChainId()), is(new StaticArray2<Uint256>( new Uint256(BigInteger.TEN), new Uint256(BigInteger.valueOf(Long.MAX_VALUE))))); assertThat(TypeDecoder.decodeStaticArray( "000000000000000000000000000000000000000000000000000000000000000d" + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000d" + "776f726c64212048656c6c6f2c00000000000000000000000000000000000000", 0, new TypeReference.StaticArrayTypeReference<StaticArray<Utf8String>>(2){}, 2, NetworkParameters.MainNetParams.getChainId() ), equalTo(new StaticArray2<Utf8String>( new Utf8String("Hello, world!"), new Utf8String("world! Hello,")))); }
@Test(expected = UnsupportedOperationException.class) public void testEmptyStaticArray() { assertThat(TypeDecoder.decodeStaticArray( "0000000000000000000000000000000000000000000000000000000000000000", 0, new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(0) {}, 0, NetworkParameters.MainNetParams.getChainId()), is("invalid")); }