Int ip Address To Dotted Decimal - Android Network

Android examples for Network:IP Address

Description

Int ip Address To Dotted Decimal

Demo Code


//package com.java2s;

public class Main {
    public static String ipToDottedDecimal(int ipAddress) {
        int a = (ipAddress >> 0) & 0xFF, b = (ipAddress >> 8) & 0xFF, c = (ipAddress >> 16) & 0xFF, d = (ipAddress >> 24) & 0xFF;
        return Integer.toString(a) + "." + Integer.toString(b) + "."
                + Integer.toString(c) + "." + Integer.toString(d);
    }//from   www.  ja  va2s  .co m
}

Related Tutorials