android根据银行卡卡号判断银行
根据银行卡号判断是哪个银行的卡,依据是银行卡号的前6位数,称之为bin号。
我们把bin号转化为长整形,再把各个银行卡的bin号做成有序表。通过二分查找的方法,找到bin号在有序表的位置,然后读出银行卡的信息。
我把这个封装成一个java类,很简单的代码:
[java]public class BankInfo {
//BIN号
private final static long[] 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,
421393,
421437,
421865,
421869,
421870,
421871,
422160,
422161,
424106,
424107,
424108,
424109,
424110,
424111,
424902,
425862,
427010,
427018,
427019,
427020,
427028,
427029,
427038,
427039,
427062,
427064,
427571,
428911,
431502,
431502,
433666,
433670,
433680,
434061,
434062,
435744,
435745,
436718,
436728,
436738,
436742,
436745,
436748,
436768,
438088,
438125,
438126,
438588,
438589,
438600,
439188,
439225,
439227,
442729,
442730,
451289,
451291,
补充:移动开发 , Android ,