Here you can find the source of ipV4ToLong(final String ipAddress)
public static final long ipV4ToLong(final String ipAddress)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 BowenCai./*w w w . java2 s .c om*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html * * Contributors: * BowenCai - initial API and implementation ******************************************************************************/ public class Main { public static final long ipV4ToLong(final String ipAddress) { long result = 0; String[] atoms = ipAddress.split("\\."); for (int i = 3; i >= 0; i--) { result |= (Long.parseLong(atoms[3 - i]) << (i * 8)); } return result & 0xFFFFFFFF; } }