Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Locale;

public class Main {
    private static String byteToHexStr(byte[] input) {
        if (input == null) {
            return "";
        }
        String output = "";
        String tmp = "";
        for (int n = 0; n < input.length; n++) {
            tmp = Integer.toHexString(input[n] & 0xFF);
            if (tmp.length() == 1) {
                output = output + "0" + tmp;
            } else {
                output = output + tmp;
            }
        }
        return output.toUpperCase(Locale.ENGLISH);
    }
}