Java Byte to Hex String byteToHexString(byte b)

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

Description

byte To Hex String

License

Open Source License

Return

hex representation of byte.

Declaration

public static String byteToHexString(byte b) 

Method Source Code

//package com.java2s;
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
* Copyright 2001-2004 Laszlo Systems, Inc.  All Rights Reserved.              *
* Use is subject to license terms.                                            *
* J_LZ_COPYRIGHT_END *********************************************************/

public class Main {
    /**//from w ww .jav a 2 s  . c o  m
     * @return hex representation of byte.
     */
    public static String byteToHexString(byte b) {
        int left = (int) ((b & 0xf0) >> 4);
        int right = (int) (b & 0x0f);
        return Integer.toHexString(left) + Integer.toHexString(right);
    }
}

Related

  1. byteToHexstr(byte[] b, boolean space)
  2. byteToHexStr(byte[] bArray)
  3. byteToHexString(byte _b)
  4. byteToHexString(byte b)
  5. byteToHexString(byte b)
  6. byteToHexString(byte b)
  7. byteToHexString(byte b)
  8. byteToHexString(byte b)
  9. byteToHexString(byte b)