Here you can find the source of IsMasterCardCreditCard( String UnformattedAccountNumber)
private static boolean IsMasterCardCreditCard( String UnformattedAccountNumber)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static boolean IsMasterCardCreditCard( String UnformattedAccountNumber) { Pattern p = Pattern.compile("^5[1-5][0-9]{14}$"); Matcher m = p.matcher(UnformattedAccountNumber); return m.matches(); }//from w w w .jav a 2 s .c o m }