public boolean isMine(Wallet wallet){
  try {
    Script script=getScriptPubKey();
    if (script.isSentToRawPubKey()) {
      byte[] pubkey=script.getPubKey();
      return wallet.isPubKeyMine(pubkey);
    }
 else {
      byte[] pubkeyHash=script.getPubKeyHash();
      return wallet.isPubKeyHashMine(pubkeyHash);
    }
  }
 catch (  ScriptException e) {
    log.debug("Could not parse tx output script: {}",e.toString());
    return false;
  }
}

public boolean isMine ( Wallet wallet ) { try { Script script = getScriptPubKey ( ) ; if ( script . isSentToRawPubKey ( ) ) { byte [ ] pubkey = script . getPubKey ( ) ; return wallet . isPubKeyMine ( pubkey ) ; } else { byte [ ] pubkeyHash = script . getPubKeyHash ( ) ; return wallet . isPubKeyHashMine ( pubkeyHash ) ; } } catch ( ScriptException e ) { log . debug ( "Could not parse tx output script: {}" , e . toString ( ) ) ; return false ; } }
returns true if this output is to a key , or an address we have the keys for , in the wallet .
