Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String getHexStr(byte[] buffer) {
        String hexStr = "";
        if (buffer != null) {
            for (byte b : buffer) {
                String temp = Integer.toHexString(b & 0xFF);
                if (temp.length() == 1) {
                    hexStr += "0";
                }

                hexStr += temp + " ";
            }

        }

        return hexStr.toUpperCase();
    }
}