Java tutorial
//package com.java2s; //License from project: Apache License import android.support.v4.view.MotionEventCompat; public class Main { public static String toHexString(byte[] bytes) { StringBuilder hexString = new StringBuilder(); for (byte b : bytes) { String str = Integer.toHexString(b & MotionEventCompat.ACTION_MASK); while (str.length() < 2) { str = "0" + str; } hexString.append(str); } return hexString.toString(); } }