• 大小: 89KB
    文件类型: .java
    金币: 1
    下载: 0 次
    发布日期: 2021-06-04
  • 语言: Java
  • 标签: bank  card  get  bankname  

资源简介

根据银行卡号 获取银行名称

资源截图

代码片段和文件信息

package com.fiveyounger.beauty.utils;

/**
 * Created by lyq on 2016/6/16.
 */
public class BankNameSearchUtil {
    //传入卡号 得到银行名称
    public static String getNameOfBank(String idCard) {
        int index = -1;

        if(idCard==null || idCard.length()<16 || idCard.length()>19){
            return “请输入正确的卡号“;
        }

        //6位Bin号
        String cardbin_6 = idCard.substring(0 6);
        for (int i = 0; i < bankBin.length; i++) {
            if (cardbin_6.equals(bankBin[i])) {
                index = i;
                break;
            }
        }
        if (index != -1) {
            return bankName[index];
        }

        //8位Bin号
        String cardbin_8 = idCard.substring(0 8);
        for (int i = 0; i < bankBin.length; i++) {
            if (cardbin_8.equals(bankBin[i])) {
                index = i;
            }
        }
        if (index != -1) {
            return bankName[index];
        }

        return ““;
    }

    //BIN号
    private final static String[] bankBin =
            {
                    “102033“
                    “103000“
                    “185720“
                    “303781“
                    “356827“
                    “356828“
                    “356833“
                    “356835“
                    “356837“
                    “356838“
                    “356839“
                    “356840“
                    “356885“
                    “356886“
                    “356887“
                    “356888“
                    “356889“
                    “356890“
                    “370246“
                    “370247“
                    “370248“
                    “370249“
                    “400360“
                    “400937“
                    “400938“
                    “400939“
                    “400940“
                    “400941“
                    “400942“
                    “402658“
                    “402673“
                    “402791“
                    “403361“
                    “403391“
                    “404117“
                    “404157“
                    “404171“
                    “404172“
                    “404173“
                    “404174“
                    “404738“
                    “404739“
                    “405512“
                    “405512“
                    “406252“
                    “406254“
                    “406365“
                    “407405“
                    “409665“
                    “409666“
                    “409667“
                    “409668“
                    “409669“
                    “409670“
                    “409671“
                    “409672“
                    “410062“
                    “412962“
                    “412963“
                    “415599“
                    “421317“
                    “421349“
         

评论

共有 条评论