Java String Value Of valueOfIpv4(String ip)

Here you can find the source of valueOfIpv4(String ip)

Description

value Of Ipv

License

Apache License

Declaration

public static long valueOfIpv4(String ip) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static long valueOfIpv4(String ip) {
        long ret = 0;
        String[] p = ip.split("\\.");
        ret += Long.parseLong(p[0]) << 24;
        ret += Long.parseLong(p[1]) << 16;
        ret += Long.parseLong(p[2]) << 8;
        ret += Long.parseLong(p[3]);
        return ret;
    }//from   w  w  w.ja  va  2s.  c o m
}

Related

  1. valueOfEnum(final Class type, final String value)
  2. valueOfIC(Class enumType, String aName)
  3. valueOfIgnoreCase(Class cls, String value)
  4. valueOfIgnoreCase(Class enumType, String constantName)
  5. valueOfInteger(final String s, int radix)
  6. valueOfLongToString(long[] values)
  7. valueOfNullSafe(final Class enumType, final String name)
  8. valueOfOrEmptyString(final Object object)
  9. valueOfString(String str, int len)