code: public static RuleViolation isStandard(Transaction tx) {
          // TODO: Finish this function off.
          if (tx.getVersion() > 2 || tx.getVersion() < 1) {
              log.warn("TX considered non-standard due to unknown version number {}", tx.getVersion());
              return RuleViolation.VERSION;
          }
  
          final List<TransactionOutput> outputs = tx.getOutputs();
          for (int i = 0; i < outputs.size(); i++) {
              TransactionOutput output = outputs.get(i);
              RuleViolation violation = isOutputStandard(output);
              if (violation != RuleViolation.NONE) {
                  log.warn("TX considered non-standard due to output {} violating rule {}", i, violation);
                  return violation;
              }
          }
  
          final List<TransactionInput> inputs = tx.getInputs();
          for (int i = 0; i < inputs.size(); i++) {
              TransactionInput input = inputs.get(i);
              RuleViolation violation = isInputStandard(input);
              if (violation != RuleViolation.NONE) {
                  log.warn("TX considered non-standard due to input {} violating rule {}", i, violation);
                  return violation;
              }
          }
  
          return RuleViolation.NONE;
      }
docs: <p>Checks if a transaction is considered "standard" by Bitcoin Core's IsStandardTx and AreInputsStandard
  functions.</p>
  
  <p>Note that this method currently only implements a minimum of checks. More to be added later.</p>