Java IP Address to String ip2string(byte[] ips)

Here you can find the source of ip2string(byte[] ips)

Description

ipstring

License

Apache License

Declaration

public static String ip2string(byte[] ips) 

Method Source Code

//package com.java2s;
/*/*from  w  ww . ja  v a 2  s  .c  o m*/
 * Copyright 2006-2011 The Virtual Laboratory for e-Science (VL-e) 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License").  
 * You may not use this file except in compliance with the License. 
 * For details, see the LICENCE.txt file location in the root directory of this 
 * distribution or obtain the Apache Licence at the following location: 
 *     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.
 * 
 * See: http://www.vl-e.nl/ 
 * See: LICENCE.txt (located in the root folder of this distribution). 
 * ---
 * $Id: NetUtil.java,v 1.1 2011-11-25 13:40:47 ptdeboer Exp $  
 * $Date: 2011-11-25 13:40:47 $
 */

public class Main {
    public static String ip2string(byte[] ips) {
        int i = 0;
        String ipstr = "";
        for (i = 0; i < ips.length - 1; i++)
            ipstr += (ips[i] & 0x00ff) + ".";
        ipstr += ips[i] & 0x00ff;

        return ipstr;
    }
}

Related

  1. convertIpToString(byte[] ip)
  2. inputStreamContent(InputStream is)
  3. ip2string(byte[] ip)
  4. ip2String(int ip)
  5. ipToIPv4Str(byte[] ip)
  6. ipToString(final byte[] address)
  7. ipToString(final byte[] bytes)