Java Byte to Hex byteToHex(byte b)

Here you can find the source of byteToHex(byte b)

Description

byte To Hex

License

Apache License

Declaration

public static String byteToHex(byte b) 

Method Source Code

//package com.java2s;
//   Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    private static final String HEX = "0123456789ABCDEF";

    public static String byteToHex(byte b) {
        int high = (b & 0xF0) >> 4;
        int low = (b & 0x0F);

        return "" + HEX.charAt(high) + HEX.charAt(low);
    }/*from w  w  w  .ja  v a  2s. c om*/
}

Related

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