Java XML Hex toHex(byte[] bytes)

Here you can find the source of toHex(byte[] bytes)

Description

to Hex

License

Open Source License

Declaration

public static String toHex(byte[] bytes) 

Method Source Code


//package com.java2s;
// distribute, sublicense, and/or sell copies of the Software, and to permit

import java.nio.charset.Charset;

import javax.xml.bind.DatatypeConverter;

public class Main {
    public static String toHex(String s, Charset cs) {
        return toHex(s.getBytes(cs));
    }/*from   w ww . j  ava  2  s . c  o m*/

    public static String toHex(String s) {
        return toHex(s.getBytes(Charset.forName("UTF-8")));
    }

    public static String toHex(byte[] bytes) {
        return DatatypeConverter.printHexBinary(bytes);
    }
}

Related

  1. stringToHex(String str)
  2. toByteArray(String hex)
  3. toByteArray(String hexDumpString)
  4. toByteArrayFromHexString(String s)
  5. toByteFromHexString(String hexString)
  6. toHex(byte[] bytes)
  7. toHex(byte[] donnees)
  8. toHex(String str)
  9. toHexString(byte[] array)