Here you can find the source of toHex(byte[] bytes)
public static String toHex(byte[] bytes)
//package com.java2s; /*//ww w. j a v a 2 s .com * Copyright 2014-2017. * Distributed under the terms of the GPLv3 License. * * Authors: * Clemens Zeidler <czei002@aucklanduni.ac.nz> */ public class Main { public static String toHex(byte[] bytes) { StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i < bytes.length; i++) stringBuffer.append(String.format("%02X", bytes[i])); return stringBuffer.toString().toLowerCase(); } }