Java examples for java.lang:byte Array to String
get Ip String From Bytes
//package com.java2s; public class Main { public static void main(String[] argv) { byte[] ip = new byte[] { 34, 35, 36, 37, 37, 37, 67, 68, 69 }; System.out.println(getIpStringFromBytes(ip)); }//from w ww.ja va 2 s. c o m public static String getIpStringFromBytes(byte[] ip) { StringBuffer sb = new StringBuffer(); sb.append(ip[0] & 0xFF); sb.append('.'); sb.append(ip[1] & 0xFF); sb.append('.'); sb.append(ip[2] & 0xFF); sb.append('.'); sb.append(ip[3] & 0xFF); return sb.toString(); } }