若IP地址问10.1.128.1
//if ip is 10.1.128.1
var a1=10<<24;
var a2=1<<16;
var a3=128<<8;
var a4=1<<1;
var IpNumber=a1+a2+a3+a4;
console.log(IpNumber,a1,a2,a3,a4);
//IpNumber 就是转换后的长整型值
//将长整型值逆转回IP地址
a = (IpNumber & 4278190080) >> 24;
b = (IpNumber & 16711680) >> 16;
c = (IpNumber & 65280) >> 8;
d = (IpNumber & 255)>>1;
console.log(a,b,c,d);
//a,b,c,d就是之前的IP 10,1,128,1