Java tutorial
//package com.java2s; //License from project: Apache License public class Main { private static String toHexEncode(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { int low = bytes[i] & 0xF; int high = (bytes[i] >>> 4) & 0xF; sb.append(Character.forDigit(high, 16)); sb.append(Character.forDigit(low, 16)); } return sb.toString(); } }