Here you can find the source of ip2long(String ip)
public static long ip2long(String ip)
//package com.java2s; public class Main { public static long ip2long(String ip) { String[] ips = ip.split("[.]"); long num = 16777216L * Long.parseLong(ips[0]) + 65536L * Long.parseLong(ips[1]) + 256 * Long.parseLong(ips[2]) + Long.parseLong(ips[3]); return num; }/* ww w . j a v a 2s . co m*/ }