Java examples for Network:Network Address
get Host Address Of Byte array
//package com.java2s; public class Main { /**/*from www . ja v a 2 s . c o m*/ * * @param bytes * @return host address,ex: 192.168.1.222 */ public static String getHostAddressOfBytes(byte[] bytes) { StringBuilder hostAddressBuilder = new StringBuilder(); for (int i = bytes.length - 1; i >= 0; i--) { hostAddressBuilder.append("." + Integer.toString(bytes[i] & 0xff)); } return hostAddressBuilder.substring(1); } }