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 byteArrayToHexString(byte[] bytes) {
        if (bytes.length == 0)
            return null;
        StringBuilder stringBuilder = new StringBuilder();
        for (byte b : bytes) {
            if (b < 16)
                stringBuilder.append("0");
            stringBuilder.append(Integer.toHexString(0xff & b));
        }
        return stringBuilder.toString();
    }
}