Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**
     * Return a hexadecimal string representation of a byte array.
     *
     * @param bytes byte[]
     * @return      String
     */
    public static String byteToHex(byte[] bytes) {
        StringBuilder bcdString = new StringBuilder();

        for (Byte b : bytes) {
            bcdString.append(String.format("%02X ", b));
        }

        return bcdString.toString().trim();
    }
}