Java tutorial
//package com.java2s; public class Main { public static String Bytes2HexString(byte[] b, int size) { String ret = ""; //for (int i = 0; i < size; i++) { for (int i = size - 1; i >= 0; i--) { String hex = Integer.toHexString(b[i] & 0xFF); if (hex.length() == 1) { hex = "0" + hex; } ret += hex.toUpperCase(); } return ret; } }