Here you can find the source of byteToHex(final byte[] data)
public static String byteToHex(final byte[] data)
//package com.java2s; /*/* ww w.j a v a 2s. c o m*/ * Copyright (c) 2016 PrivatBank IT <acsk@privatbank.ua>. All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ public class Main { public static String byteToHex(final byte[] data) { final StringBuilder hex = new StringBuilder(); for (int i = 0; i < data.length; i++) { hex.append(String.format("%02x", data[i])); } return hex.toString(); } }