How do I get the address that received a payment? I am using BitcoinJ and wondering who user that I should credit, all users have their own receiving addresses. Please post an example also, if you have time. :)
Current code:

    wallet.addEventListener(new AbstractWalletEventListener(){
        @Override
        public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
            String txid = tx.getHashAsString();
            long received = newBalance.value-prevBalance.value;
            String address; // The receive address that the payment was sent to.
            int UserID = MySQL.getUserIDbyAddress(address);
            // Here will I credit the user.
        }
    });
I found out in the end how to do it, here you can see:

    wallet.addEventListener(new AbstractWalletEventListener(){
        @Override
        public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
            String hash = tx.getHashAsString();
            long received = newBalance.value-prevBalance.value;
            String address = null;
            for (TransactionOutput txop : tx.getOutputs()){
                if (txop.isMine(wallet)){
                    address = txop.getScriptPubKey().getToAddress(params).toString();
                }
            }
            int UserID = MySQL.getUserIDbyAddress(address);
            // Code...
        }
    });