How to get senders address with bitcoinj (no duplicate)?
For future reference:
In bitcoinJ (java version) the input/output addresses of transactions are located in TransactionInput and TransactionOutput objects.

For example: for Transaction tx:

List&lt;TransactionInput&gt; inputs = tx.getInputs();
List&lt;TransactionOutput&gt; outputs = tx.getOutputs();

for(TransactionOutput out : outputs){
    System.out.println(out.getAddressFromP2PKHScript(params));
    System.out.println(out.getAddressFromP2SH(params));
}

for(TransactionInput in : inputs){
    System.out.println(in.getFromAddress());
}


Keep in mind that some transactions might not have an input address.
Here is the github description of getFromAddress() method:


  Convenience method that returns the from address of this input by parsing the scriptSig. The concept of a "from address" is not well defined in Bitcoin and you should not assume that senders of a transaction can actually receive coins on the same address they used to sign (e.g. this is not true for shared wallets).