Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    private static String byte2hex(byte[] b) {

        StringBuffer buffer = new StringBuffer();
        String tmp = "";

        for (int n = 0; n < b.length; n++) {

            tmp = (java.lang.Integer.toHexString(b[n] & 0XFF));

            if (1 == tmp.length()) {

                buffer.append("0").append(tmp);

            } else {

                buffer.append(tmp);

            }
        }

        return buffer.toString().toUpperCase();
    }
}