Here you can find the source of intToIp(int i)
static String intToIp(int i)
//package com.java2s; /*/*ww w . jav a 2 s .c om*/ * Copyright 2012 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ public class Main { private static final int SECOND_ADDRESS_OCTET_SHIFT = 16; private static final int FIRST_ADDRESS_OCTET_SHIFT = 24; private static final int THIRD_ADDRESS_OCTET_SHIFT = 8; private static final int XOR_DEFAULT_VALUE = 0xff; static String intToIp(int i) { return String.valueOf(i >> FIRST_ADDRESS_OCTET_SHIFT & XOR_DEFAULT_VALUE) + '.' + (i >> SECOND_ADDRESS_OCTET_SHIFT & XOR_DEFAULT_VALUE) + '.' + (i >> THIRD_ADDRESS_OCTET_SHIFT & XOR_DEFAULT_VALUE) + '.' + (i & XOR_DEFAULT_VALUE); } }