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[] value) {
        StringBuilder stringBuilder = new StringBuilder("");
        for (int i = 0; i < value.length; i++) {
            int v = value[i] & 0xFF;
            String hv = Integer.toHexString(v);
            if (hv.length() < 2) {
                stringBuilder.append(0);
            }
            stringBuilder.append(hv);
        }
        return stringBuilder.toString();
    }
}