Android Byte Array to Hex Convert convertToHex(byte[] in)

Here you can find the source of convertToHex(byte[] in)

Description

convert To Hex

Declaration

private static String convertToHex(byte[] in) 

Method Source Code

//package com.java2s;

import java.util.Formatter;

public class Main {
    private static String convertToHex(byte[] in) {
        StringBuilder builder = new StringBuilder(in.length * 2);

        Formatter formatter = new Formatter(builder);
        for (byte inByte : in)
            formatter.format("%02x", inByte);

        formatter.close();/*from  w w w.  ja  va2s  . c om*/

        return formatter.toString();
    }
}

Related

  1. bytesToHex(byte[] bytes)
  2. bytesToHex(byte[] bytes, boolean withSpaces)
  3. byteArrayToHexString(byte[] bytes)
  4. byteArrayToHexString(byte[] bytes)
  5. bytesToHex(byte[] data)
  6. convertToHex(byte[] raw)
  7. bytes2Hex(byte[] bts)
  8. bytes2HexString(byte[] bytes)
  9. bytes2hex(byte[] bytes)