code: public Coin getOutputSum() {
          Coin totalOut = Coin.ZERO;
  
          for (TransactionOutput output: outputs) {
              totalOut = totalOut.add(output.getValue());
          }
  
          return totalOut;
      }
docs: Gets the sum of the outputs of the transaction. If the outputs are less than the inputs, it does not count the fee.
  @return the sum of the outputs regardless of who owns them.