Script { public boolean isSentToP2SH() { return chunks.size() == 3 && chunks.get(0).equalsOpCode(OP_HASH160) && chunks.get(1).data.length == Address.LENGTH && chunks.get(2).equalsOpCode(OP_EQUAL); } private  Script();   Script(List<ScriptChunk> chunks);  Script(byte[] programBytes);  Script(byte[] programBytes, long creationTimeSeconds); long getCreationTimeSeconds(); void setCreationTimeSeconds(long creationTimeSeconds); String toString(); byte[] getProgram(); List<ScriptChunk> getChunks(); boolean isSentToRawPubKey(); boolean isSentToAddress(); boolean isSentToP2SH(); byte[] getPubKeyHash(); byte[] getPubKey(); @Deprecated Address getFromAddress(NetworkParameters params); Address getToAddress(NetworkParameters params); static void writeBytes(OutputStream os, byte[] buf); static byte[] createMultiSigOutputScript(int threshold, List<ECKey> pubkeys); static byte[] createInputScript(byte[] signature, byte[] pubkey); static byte[] createInputScript(byte[] signature); static int decodeFromOpN(byte opcode); static int getSigOpCount(byte[] program); static long getP2SHSigOpCount(byte[] scriptSig); boolean isPayToScriptHash(); boolean isSentToMultiSig(); static byte[] removeAllInstancesOf(byte[] inputScript, byte[] chunkToRemove); static byte[] removeAllInstancesOfOp(byte[] inputScript, int opCode); void correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey,
                                boolean enforceP2SH); @Override boolean equals(Object obj); @Override int hashCode(); static final long MAX_SCRIPT_ELEMENT_SIZE; }
@Test public void testP2SHOutputScript() throws Exception { Address p2shAddress = new Address(MainNetParams.get(), "35b9vsyH1KoFT5a5KtrKusaCcPLkiSo1tU"); assertTrue(ScriptBuilder.createOutputScript(p2shAddress).isSentToP2SH()); }