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 bytesToHexString(byte[] paramArrayOfByte) {
        StringBuilder localStringBuilder = new StringBuilder();
        if ((paramArrayOfByte == null) || (paramArrayOfByte.length <= 0)) {
            return null;
        }
        char[] arrayOfChar = new char[2];
        for (int i = 0;; i++) {
            if (i >= paramArrayOfByte.length) {
                return localStringBuilder.toString().toUpperCase();
            }
            arrayOfChar[0] = Character.forDigit(0xF & paramArrayOfByte[i] >>> 4, 16);
            arrayOfChar[1] = Character.forDigit(0xF & paramArrayOfByte[i], 16);
            localStringBuilder.append(arrayOfChar);
        }
    }
}