code: public int getMessageSizeForPriorityCalc() {
          int size = getMessageSize();
          for (TransactionInput input : inputs) {
              // 41: min size of an input
              // 110: enough to cover a compressed pubkey p2sh redemption (somewhat arbitrary).
              int benefit = 41 + Math.min(110, input.getScriptSig().getProgram().length);
              if (size > benefit)
                  size -= benefit;
          }
          return size;
      }
docs: The priority (coin age) calculation doesn't use the regular message size, but rather one adjusted downwards
  for the number of inputs. The goal is to incentivise cleaning up the UTXO set with free transactions, if one
  can do so.