Java Byte to Hex bytesToUpperCaseHex(byte[] b)

Here you can find the source of bytesToUpperCaseHex(byte[] b)

Description

bytes To Upper Case Hex

License

Apache License

Declaration

@SuppressWarnings("unused")
    private static String bytesToUpperCaseHex(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    @SuppressWarnings("unused")
    private static String bytesToUpperCaseHex(byte[] b) {
        char hexDigit[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
        StringBuffer buf = new StringBuffer();
        for (int j = 0; j < b.length; j++) {
            buf.append(hexDigit[(b[j] >> 4) & 0x0f]);
            buf.append(hexDigit[b[j] & 0x0f]);
        }//from  w  ww  . j  a v  a  2s  .c o m
        return buf.toString();
    }
}

Related

  1. bytesToHexs(byte[] buf)
  2. bytesToLowerCaseHex(byte[] data)
  3. bytesToModHex(final byte[] inputBytes)
  4. bytesToPrettyHex(byte[] data)
  5. bytesToReadableHexStr(byte[] msg)
  6. byteToHex(byte a)
  7. byteToHex(byte b)
  8. byteToHex(byte b)
  9. byteToHex(byte b)