All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.loocme.sys.util.PrintUtil Maven / Gradle / Ivy

package com.loocme.sys.util;

/**
 * @author liuchi
 */
public class PrintUtil
{

    public static String byte2HexString(byte[] b)
    {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < b.length; i++)
        {
            if (i % 16 == 0)
            {
                sb.append("\n\t");
            }
            String hex = Integer.toHexString(b[i] & 0xFF);
            if (hex.length() == 1)
            {
                hex = '0' + hex;
            }
            sb.append(hex.toUpperCase()).append(" ");
        }
        return sb.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy