Convert int To Ip address and return string - Android java.net

Android examples for java.net:IP Address

Description

Convert int To Ip address and return string

Demo Code


public class Main{

    public static String intToIp(int ip)

    {//from   w  w  w.j  a  va2  s.c om
        return (ip & 0xFF) + "." + ((ip >> 8) & 0xFF) + "."
                + ((ip >> 16) & 0xFF) + "." + ((ip >> 24) & 0xFF);

    }

}

Related Tutorials