Here you can find the source of toHexStringArray(byte[] data, int offset, int length)
public static String[] toHexStringArray(byte[] data, int offset, int length)
//package com.java2s; public class Main { static final char[] HEXS = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String[] toHexStringArray(byte[] data, int offset, int length) { String[] result = new String[length]; StringBuilder s = new StringBuilder(length * 2); int end = offset + length; int high_nibble; int low_nibble; for (int i = offset, j = 0, k = 0; i < end; i++, j++, k += 2) { high_nibble = (data[i] & 0xF0) >>> 4; low_nibble = (data[i] & 0x0F); s.append(HEXS[high_nibble]); s.append(HEXS[low_nibble]);/* w w w . j av a 2 s . c om*/ result[j] = s.substring(k); } s.delete(0, s.length() - 1); s = null; return result; } }