Here you can find the source of IsDiscoverCreditCard( String UnformattedAccountNumber)
private static boolean IsDiscoverCreditCard( String UnformattedAccountNumber)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static boolean IsDiscoverCreditCard( String UnformattedAccountNumber) { Pattern p = Pattern.compile("^6(?:011|5[0-9]{2})[0-9]{12}$"); Matcher m = p.matcher(UnformattedAccountNumber); return m.matches(); }//from w w w .j ava 2 s. c o m }