Here you can find the source of ip2Long(final String ip)
public static long ip2Long(final String ip)
//package com.java2s; // Licensed to the Apache Software Foundation (ASF) under one public class Main { public static long ip2Long(final String ip) { final String[] tokens = ip.split("[.]"); assert tokens.length == 4; long result = 0; for (int i = 0; i < tokens.length; i++) { try { result = result << 8 | Integer.parseInt(tokens[i]); } catch (final NumberFormatException e) { throw new RuntimeException("Incorrect number", e); }/*w w w. j a va 2 s.c o m*/ } return result; } }