Here you can find the source of bytes2StringPtr(byte[] data, String type)
public static String bytes2StringPtr(byte[] data, String type)
//package com.java2s; public class Main { public static String bytes2StringPtr(byte[] data, String type) { if (type == null) { type = ""; }/*w w w . ja v a2 s . c om*/ StringBuffer sb = new StringBuffer(); System.out.println(); for (int i = 0; i < data.length; i++) { sb.append(String.format("".equals(type) ? "0x%x," : type + ",", data[i])); } return sb.toString(); } public static byte[] append(byte[] data, byte[] adata) { if (data == null) { data = new byte[0]; } int len = data.length; if (adata == null) { return data; } int alen = adata.length; byte[] result = new byte[(len + alen)]; for (int i = 0, j = 0; i < len + alen; i++) { if (i < len) { result[i] = data[i]; continue; } result[i] = adata[j]; j++; } return result; } }