---
title: "WIFI IP转换"
author: "yinter"
date: "2010-01-14T14:01:21Z"
tags: []
categories: ["移动开发"]
slug: "wifi-ip"
draft: false
lastmod: "2010-03-04T14:08:21Z"
id: 570069
url: "https://yinter.iteye.com/blog/570069"
---

private String intToIp(int i) {
		/**
		* &quot; -- 表示双引号(")
	    * &amp; -- 表示位与运算符(&)
	    * &lt; -- 表示小于运算符(<)
	    * &gt; -- 表示大于运算符(>)
	    * &nbsp; -- 表示空格( )
		*/
    	return 
    	( i & 0xFF) + "." +
    	((i >> 8 ) & 0xFF) + "." +
    	((i >> 16 ) & 0xFF) + "." +
        ((i >> 24 ) & 0xFF)
        ;
    }

由于int是32位，和0xff相与后，高24比特就会被清0。

Integral Types and Values
The values of the integral types are integers in the following ranges:

    * For byte, from -128 to 127, inclusive
    * For short, from -32768 to 32767, inclusive
    * For int, from -2147483648 to 2147483647, inclusive
    * For long, from -9223372036854775808 to 9223372036854775807, inclusive
    * For char, from '\u0000' to '\uffff' inclusive, that is, from 0 to 65535