Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Transforms a byte array in a hex string
     * 
     * @param digest
     *            Digest
     * @return Display ready string
     */
    public static String ToHexString(byte[] digest) {
        StringBuffer hexStr = new StringBuffer(40);
        for (byte b : digest) {
            hexStr.append(Integer.toString((b & 0xff) + 0x100, 16).substring(1));
        }
        return hexStr.toString();
    }
}