code: protected static NumberPattern select(BigDecimal n, NumberPattern[] patterns) {
      return n.signum() == -1 ? patterns[1] : patterns[0];
    }
docs: Select the appropriate pattern to format a positive or negative number.