### Question:
TypeDecoder { @SuppressWarnings("unchecked") static <T extends Type> T decode(String input, int offset, Class<T> type, long chainId) { if (NumericType.class.isAssignableFrom(type)) { return (T) decodeNumeric(input.substring(offset), (Class<NumericType>) type); } else if (Address.class.isAssignableFrom(type)) { return (T) decodeAddress(input.substring(offset), chainId); } else if (Bool.class.isAssignableFrom(type)) { return (T) decodeBool(input, offset); } else if (Bytes.class.isAssignableFrom(type)) { return (T) decodeBytes(input, offset, (Class<Bytes>) type); } else if (DynamicBytes.class.isAssignableFrom(type)) { return (T) decodeDynamicBytes(input, offset, chainId); } else if (Utf8String.class.isAssignableFrom(type)) { return (T) decodeUtf8String(input, offset, chainId); } else if (Array.class.isAssignableFrom(type)) { throw new UnsupportedOperationException( "Array types must be wrapped in a TypeReference"); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + type.getClass()); } }  static T decode(
            String input, int offset, TypeReference<T> typeReference,long chainId);  }### Answer:
@Test public void testBoolDecodeGivenOffset() { assertThat(TypeDecoder.decode( "0000000000000000000000000000000000000000000000007fffffffffffffff" + "0000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000007fffffffffffffff", 64, Bool.class, NetworkParameters.MainNetParams.getChainId()), is(new Bool(false))); assertThat(TypeDecoder.decode( "0000000000000000000000000000000000000000000000007fffffffffffffff" + "0000000000000000000000000000000000000000000000000000000000000001" + "0000000000000000000000000000000000000000000000007fffffffffffffff", 64, Bool.class, NetworkParameters.MainNetParams.getChainId()), is(new Bool(true))); }