Java Byte to Hex String byteToHexStringSingle(byte[] byteArray)

Here you can find the source of byteToHexStringSingle(byte[] byteArray)

Description

byte To Hex String Single

License

Apache License

Declaration

public static String byteToHexStringSingle(byte[] byteArray) 

Method Source Code

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

public class Main {

    public static String byteToHexStringSingle(byte[] byteArray) {
        StringBuffer md5StrBuff = new StringBuffer();

        for (int i = 0; i < byteArray.length; i++) {
            if (Integer.toHexString(0xFF & byteArray[i]).length() == 1) {
                md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
            } else {
                md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
            }/*from  w  w w .  j  a  va  2s  . com*/
        }

        return md5StrBuff.toString();
    }
}

Related

  1. byteToHexString(final byte b)
  2. byteToHexString(final byte inbyte)
  3. byteToHexString(int b)
  4. byteToHexString(int nib1, int nib2)
  5. byteToHexStringPadded(int value)