code: static boolean isValidCardLength(
              @Nullable String cardNumber,
              @NonNull @CardBrand String cardBrand) {
          if (cardNumber == null || Card.UNKNOWN.equals(cardBrand)) {
              return false;
          }
  
          int length = cardNumber.length();
          switch (cardBrand) {
              case Card.AMERICAN_EXPRESS:
                  return length == LENGTH_AMERICAN_EXPRESS;
              case Card.DINERS_CLUB:
                  return length == LENGTH_DINERS_CLUB;
              default:
                  return length == LENGTH_COMMON_CARD;
          }
      }
docs: Checks to see whether the input number is of the correct length, given the assumed brand of
  the card. This function does not perform a Luhn check.
  
  @param cardNumber the card number with no spaces or dashes
  @param cardBrand a {@link CardBrand} used to get the correct size
  @return {@code true} if the card number is the correct length for the assumed brand