Here you can find the source of toRadix16(byte[] source, int srcOffset, int len)
public static String toRadix16(byte[] source, int srcOffset, int len)
//package com.java2s; //License from project: Apache License public class Main { private static final String HEX = "0123456789abcdef"; public static String toRadix16(byte[] source, int srcOffset, int len) { char[] hex = new char[len * 2]; for (int j = 0; j < len; j++) { int b = source[j + srcOffset] & 0xFF; hex[j * 2] = HEX.charAt(b >>> 4); hex[j * 2 + 1] = HEX.charAt(b & 0x0F); }//from w w w . ja v a2 s.c o m return new String(hex); } }