How do we verify the signature on a raw transaction using Bitcoinj? I managed to create a raw tx using Bitcoinj but not able to figure out how to verify its signatures. 
Assuming I know the addresses corresponding to the (supposedly) unspent outputs used as inputs to the Tx, what is the easiest way to verify the Tx?
You're interested in the following API calls:

public List&lt;TransactionInput&gt; Transaction.getInputs()
public Script TransactionInput.getScriptSig() throws ScriptException
public void Script.correctlySpends(Transaction txContainingThis, long scriptSigIndex, Script scriptPubKey)


Use them like so:

Transaction tx = ...
List&lt;TransactionInput&gt; inputs = tx.getInputs();
for(int i = 0; i &lt; inputs.size(); i++) {
    TransactionInput input = inputs.get(i);
    Script scriptSig = input.getScriptSig();
    Script scriptPubKey = ...
    scriptSig.correctlySpends(tx, i, scriptPubKey);
}


The tricky bit is getting scriptPubKey. If you have the transactions you're spending in memory, it's as simple as input.getConnectedOutput().getScriptPubKey();

If it isn't, then you can make an educated guess by converting the address to a P2PKH scriptPubKey.

public static Script ScriptBuilder.createOutputScript(Address to)


This creates an edge case where if someone tries to spend a P2PK output, it will appear to be signed incorrectly to your program. (Both are represented by addresses.)