Mega Code Archive

 
Categories / Android / Network
 

Ip To Dotted Decimal

//package edu.umich.jezzball.net; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; class Utility {   static final int IP_ADDRESS_LENGTH = 32;   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);   } }