Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    private static final boolean DEBUG_FLG = false;

    public static String makeHexTextD(byte[] data) {
        if (DEBUG_FLG) {
            return makeHexText(data);
        }
        return "";
    }

    public static String makeHexText(byte[] data) {

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < data.length; i++) {
            if (i != 0) {
                sb.append("-");
            }
            sb.append(String.format("%02X", data[i]));
        }
        return sb.toString();
    }
}