Here you can find the source of convertByteToString(byte[] objectGuid)
public final static String convertByteToString(byte[] objectGuid)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.Collection; public class Main { public final static String convertByteToString(byte[] objectGuid) { StringBuilder builder = new StringBuilder(); for (byte element : objectGuid) { int item = element & 0xFF; if (item <= 0xF) { builder.append("0"); }//from w w w. j a v a2s . c om builder.append(Integer.toHexString(item)); } return builder.toString(); } public static String toString(String delimiter, String... values) { if (values == null) { return ""; } return toString(Arrays.asList(values), delimiter); } /** * Convert a collection of string values into a delimited string. * * @param values * @param delimiter delimiter string * @return delimited string */ public static String toString(Collection<String> values, String delimiter) { if (values == null) { return ""; } StringBuilder builder = new StringBuilder(); int delim = 0; for (String value : values) { if (builder.length() > 0) { builder.append(delimiter); } for (char ch : value.toCharArray()) { if (delim < delimiter.length() && ch == delimiter.charAt(delim)) { delim++; if (delim == delimiter.length()) { builder.append('\\'); builder.append(delimiter); delim = 0; } } else if (ch == '\n') { builder.append("\\n"); } else if (ch == '\r') { builder.append("\\r"); } else if (ch == '\t') { builder.append("\\t"); } else if (ch == '\\') { builder.append("\\\\"); } else { builder.append(ch); } } } return builder.toString(); } }