Here you can find the source of toBase16(int[] arr)
public static String toBase16(int[] arr)
//package com.java2s; //License from project: Apache License public class Main { public static String toBase16(int[] arr) { return toBase16(arr, ","); }//w w w.jav a 2 s. c om public static String toBase16(int[] arr, String delimiter) { if (arr == null) { return ""; } StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; i++) { sb.append(toBase16(arr[i])); if (i < arr.length - 1) { sb.append(delimiter); } } return sb.toString(); } public static String toBase16(int b) { if (b > 0xff) { throw new IllegalArgumentException(String.format("Input value [%1$s] is larger than a byte", b)); } if (b < 0x10) { return "0x0" + Integer.toHexString(b); } else { return "0x" + Integer.toHexString(b); } } /** * Converts an int array to string. * Note: this method does not validate that int values map * to valid characters * * @param arr * @return */ public static String toString(int[] arr) { if (arr == null) { return ""; } StringBuffer sb = new StringBuffer(); for (int anArr : arr) { sb.append((char) anArr); } return sb.toString(); } }