Java Utililty Methods Hex Calculate

List of utility methods to do Hex Calculate

Description

The list of methods to do Hex Calculate are organized into topic(s).

Method

StringtoHexStringLE(byte n)
to Hex String LE
return byteArrayToHexString(toByteArrayLE(n));
StringtoHexStringUpperCase(byte[] b)
to Hex String Upper Case
StringBuffer sb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
    sb.append(hexCharsUpperCase[(int) (((int) b[i] >> 4) & 0x0f)]);
    sb.append(hexCharsUpperCase[(int) (((int) b[i]) & 0x0f)]);
return sb.toString();
StringtoHexTable(byte[] byteSrc, int lengthOfLine)
to Hex Table
return toHexTable(byteSrc, lengthOfLine, 7);
StringtoHexText(byte[] bytes, int length)
Converts the specified byte array up to the specified length into a hexadecimal text.
if (bytes == null)
    return "null";
if (length > bytes.length)
    length = bytes.length;
StringBuilder sb = new StringBuilder();
if (16 < length)
    sb.append('\n');
for (int index = 0; index < length; ++index) {
...
StringtoHexUtil(int n)
to Hex Util
String rt = "";
switch (n) {
case 10:
    rt += "A";
    break;
case 11:
    rt += "B";
    break;
...
StringtoHexValue(int number)
to Hex Value
StringBuilder builder = new StringBuilder(Integer.toHexString(number & 0xff));
while (builder.length() < 2) {
    builder.append("0");
return builder.toString().toUpperCase();
StringtoHexWithMarker(byte b)
to Hex With Marker
StringBuilder sb = new StringBuilder();
sb.append("0x").append(toHex(b));
return sb.toString();