transform IP address in int value To String format - Android Network

Android examples for Network:IP Address

Description

transform IP address in int value To String format

Demo Code


//package com.java2s;

public class Main {
    public static String transformToHost(int ip) {
        return (ip & 0xFF) + "." + (0xFF & (ip >> 8)) + "."
                + (0xFF & (ip >> 16)) + "." + (0xFF & (ip >> 24));
    }/*from  w  ww .j a va2  s . c  om*/
}

Related Tutorials