public static boolean isCardMatch(String cardType, String cardNumberPassed) {
        if (isEmpty(cardType)) return defaultEmptyOK;
        if (isEmpty(cardNumberPassed)) return defaultEmptyOK;
        String cardNumber = stripCharsInBag(cardNumberPassed, creditCardDelimiters);

        if ((cardType.equalsIgnoreCase("VISA")) && (isVisa(cardNumber))) return true;
        if ((cardType.equalsIgnoreCase("MASTERCARD")) && (isMasterCard(cardNumber))) return true;
        if (((cardType.equalsIgnoreCase("AMERICANEXPRESS")) || (cardType.equalsIgnoreCase("AMEX"))) && (isAmericanExpress(cardNumber))) return true;
        if ((cardType.equalsIgnoreCase("DISCOVER")) && (isDiscover(cardNumber))) return true;
        if ((cardType.equalsIgnoreCase("JCB")) && (isJCB(cardNumber))) return true;
        if (((cardType.equalsIgnoreCase("DINERSCLUB")) || (cardType.equalsIgnoreCase("DINERS"))) && (isDinersClub(cardNumber))) return true;
        if ((cardType.equalsIgnoreCase("CARTEBLANCHE")) && (isCarteBlanche(cardNumber))) return true;
        if ((cardType.equalsIgnoreCase("ENROUTE")) && (isEnRoute(cardNumber))) return true;
        return false;
    }
public static boolean isCardMatch ( String cardType , String cardNumberPassed ) { if ( isEmpty ( cardType ) ) return defaultEmptyOK ; if ( isEmpty ( cardNumberPassed ) ) return defaultEmptyOK ; String cardNumber = stripCharsInBag ( cardNumberPassed , creditCardDelimiters ) ; if ( ( cardType . equalsIgnoreCase ( "VISA" ) ) && ( isVisa ( cardNumber ) ) ) return true ; if ( ( cardType . equalsIgnoreCase ( "MASTERCARD" ) ) && ( isMasterCard ( cardNumber ) ) ) return true ; if ( ( ( cardType . equalsIgnoreCase ( "AMERICANEXPRESS" ) ) || ( cardType . equalsIgnoreCase ( "AMEX" ) ) ) && ( isAmericanExpress ( cardNumber ) ) ) return true ; if ( ( cardType . equalsIgnoreCase ( "DISCOVER" ) ) && ( isDiscover ( cardNumber ) ) ) return true ; if ( ( cardType . equalsIgnoreCase ( "JCB" ) ) && ( isJCB ( cardNumber ) ) ) return true ; if ( ( ( cardType . equalsIgnoreCase ( "DINERSCLUB" ) ) || ( cardType . equalsIgnoreCase ( "DINERS" ) ) ) && ( isDinersClub ( cardNumber ) ) ) return true ; if ( ( cardType . equalsIgnoreCase ( "CARTEBLANCHE" ) ) && ( isCarteBlanche ( cardNumber ) ) ) return true ; if ( ( cardType . equalsIgnoreCase ( "ENROUTE" ) ) && ( isEnRoute ( cardNumber ) ) ) return true ; return false ; }
Checks to see if the cc number is a valid number for the specified type
@param    cardType - a string representing the credit card type
@param    cardNumberPassed - a string representing a credit card number
@return  true, if the credit card number is valid for the particular credit card type given in "cardType", false otherwise