获取字节数组的主机地址
//package com.nowjava; /* 来 自 n o w j a v a . c o m - 时 代 Java*/ public class Main { /** * * @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); } }